I have two IQueryable queries:
IQueryable<Ad> list1 = db.Ads.Where(x=>x.isModerated == true);
IQueryable<Ad> list2;
if(something == true)
{
list2 = list1.Where(x=>x.TypeId == 2)
// is it going to be the same as query below?
IQueryable<Ad> list1 = db.Ads.Where(x=>x.isModerated == true && x.TypeId == 2)
}
and what if I would like to get a data using OR (||) operator is the same scenario.
And I believe it is going to be one db call until I want to iterate this query. Right?
Where
clauses are And'ed together. If you need or logic that has to be in oneWhere
.