Dapper supports this directly. For example…
string sql = "SELECT * FROM SomeTable WHERE id IN @ids"
var results = conn.Query(sql, new { ids = new[] { 1, 2, 3, 4, 5 }});
unless you are using Postgres, in which case see this answer
More Related Contents:
- store image in database or in a system file? [closed]
- SQL Identity (autonumber) is Incremented Even with a Transaction Rollback
- Fastest way to perform nested bulk inserts with scope_identity() usage?
- Is there a way to call a stored procedure with Dapper?
- Does Dapper support SQL 2008 Table-Valued Parameters?
- Bulk Insert to Oracle using .NET
- Parameterized Queries with LIKE and IN conditions
- Using “GO” within a transaction
- Does End Using close an open SQL Connection
- Does this code prevent SQL injection?
- Sanitize table/column name in Dynamic SQL in .NET? (Prevent SQL injection attacks)
- How do I write LINQ’s .Skip(1000).Take(100) in pure SQL?
- Why doesn’t Dapper dot net open and close the connection itself?
- How can you name the Dataset’s Tables you return in a stored proc?
- How can I create database tables from XSD files?
- How can I avoid SQL injection attacks in my ASP.NET application?
- Closing connection when using Dapper
- Why is some sql query much slower when used with SqlCommand?
- Is it possible to send a collection of ID’s as a ADO.NET SQL parameter?
- Dapper and SQL Injections
- How can I configure Entity Framework to automatically trim values retrieved for specific columns mapped to char(N) fields?
- How do I convert a string into safe SQL String?
- Regular expression to find all table names in a query
- How to return a page of results from SQL?
- Using a variable for table name in ‘From’ clause in SQL Server 2008
- How do parameterized queries help against SQL injection?
- New asp.net charting controls – will they work with MVC (eventually)?
- How do you keep user.config settings across different assembly versions in .net?
- How to completely uninstall Visual Studio 2010?
- When should I dispose my objects in .NET?