DAPPER:针对多个列的参数化SQL搜索匹配

时间:2014-07-24 18:53:05

标签: dapper

使用Dapper和Oracle我想给查询一个元组列表或三个单独的列表,并生成一个如下所示的查询:

SELECT * FROM my_table WHERE (id,name,date)
IN ((1,'new','10-JUL-13'),(2, 'old','09-JUN-13'),(3,'ancient','08-JAN-87'))

有没有办法在C#中格式化查询以实现此目的?类似的东西:

var query = "SELECT * FROM my_table WHERE (id,name,date) IN (:ids,:names,:dates)";
var result = connection.Query<MyClass>(query, new{ ids, names, dates });

或者:

var query = "SELECT * FROM my_table WHERE (id,name,date) IN (:myTuple)";
var result = connection.Query<MyClass>(query, new{ myTuple });

0 个答案:

没有答案