Greetings, I am having some issues with using a bool operation within a Where clause extension method of an IQueryable object obtained using Linq to Entities. The first example is showing what does work using Bool1 as the operation I need to move to a where clause extension method. The second example is what doesn't work after the change. Bool1 is is completely ignored and doesn't impact the results.
Example 1:
var results =
from a in context.aTable1
where a.Bool1 == false && a.Bool2 == false
select new
{
Column1 = a.Column1
Bool1 = a.Bool1
Bool2 = a.Bool2
};
results.Where(l => l. Column1.Contains(fooString));
Example 2:
var results =
from a in context.aTable1
where a.Bool2 == false
select new
{
Column1 = a.Column1
Bool1 = a.Bool1
Bool2 = a.Bool2
};
results.Where(l => l.Bool1 == false);
results.Where(l => l. Column1.Contains(fooString));
These are over simplified examples, however I hope they show what I am trying to do. The where extension methods are in a different method and are the reason they cannot be done when I am creating the original query.
I have tried the following other ways of doing the same thing with that where clause:
results.Where(l => !l.Bool1);
results.Where(l => l.Bool1.Equals(false));
They have the same effect which is nothing.