/// Dapper Select with type
/// https://github.com/StackExchange/Dapper
public class SimpProduct {
public int ProductID { get; set; }
public string ProductName { get; set; }
}
using (var conn = new SqlConnection (connStr)) {
//1) Return specifical type
//2) Array of Int => WHERE col in (@arg1,@arg2,@arg3)
var list = conn.Query<SimpProduct> (
"SELECT * FROM Products WHERE CategoryID IN @id",
new { id = new int[] { 1, 4 } });
foreach (var item in list) {
$"{item.ProductID} {item.ProductName}".Dump();
}
}