I think I am following the solution from this post but I am not sure why I am getting this error:No mapping exists from object type System.Collections.Generic.List`1 to a known managed provider native type
This is my code:
public virtual IEnumerable<MyModel> QueryAllById(ICollection<string> ids)
{
var sql = mySelectQuery + @"
WHERE SomeId IN @Ids
";
return Db.Query<MyModel>(sql, new { Ids = new[] { ids } });
}
You can convert ICollection to Array.
public virtual IEnumerable<MyModel> QueryAllById(ICollection<string> ids)
{
var sql = mySelectQuery + @"
WHERE SomeId IN @Ids
";
return Db.Query<MyModel>(sql, new { Ids = ids.ToArray() });
}