Dapper.NET 用动态参数查询
示例
var color = "Black"; var age = 4; var query = "Select * from Cats where Color = :Color and Age > :Age"; var dynamicParameters = new DynamicParameters(); dynamicParameters.Add("Color", color); dynamicParameters.Add("Age", age); using (var connection = new SqlConnection(/* Your Connection String Here */)) { IEnumerable<dynamic> results = connection.Query(query, dynamicParameters); }