我想我正在遵循this post的解决方案 但我不知道为什么我收到此错误:从对象类型System.Collections.Generic.List`1到已知的托管提供程序本机类型
没有映射这是我的代码:
public virtual IEnumerable<MyModel> QueryAllById(ICollection<string> ids)
{
var sql = mySelectQuery + @"
WHERE SomeId IN @Ids
";
return Db.Query<MyModel>(sql, new { Ids = new[] { ids } });
}
答案 0 :(得分:2)
您可以将ICollection转换为数组。
public virtual IEnumerable<MyModel> QueryAllById(ICollection<string> ids)
{
var sql = mySelectQuery + @"
WHERE SomeId IN @Ids
";
return Db.Query<MyModel>(sql, new { Ids = ids.ToArray() });
}