I am not sure if this is correct or not. Is there a better way to do this:
public List<Category> ManyCategories(IEnumerable<int> cats)
{
string categoriesJoined = string.Join(",", cats);
using (var conn = new SqlConnection())
{
conn.Open();
return _categories = conn.Query<Category>("select Id, ParentId, Name from [Meshplex].[dbo].Category where Id IN (@joined)", new { joined = categoriesJoined }).ToList();
}
}
source
share