I'm looking for to build the Lambda expression like the below
IQueryable<Object> queryEntity =
_db.Projects.Where(Project=>Project.Id.IN(1,2,3,4));
I don't find any IN
operator in Lambda expression.
Anybody have suggestions?
Use IEnumerable.Contains for this.
var idList = new[] { 1, 2, 3, 4 };
IQueryable<Object> queryEntity =
_db.Projects.Where(Project => idList.Contains(Project.Id));
You could construct the idList
inline of course.