I have a request that takes in a list of ids and I want to return objects if they are found within that list
for example
public async Task<IEnumerable<ChatThread>> GetThreadByIDS(List<long> ids)
{
// how do I query dbContext to get all chat threads based on a list of ids ?
}
2
Answers
Something like this:
Assuming that you have a list named "listOfIds" and your entity is "students".
so your query should be :
dbContext.Set().Where(x => listOfIds.Contains(x.Id));