In one code i had the following filter Definition (filter
is a instance of FilterDefinitionBuiler<T>
)
filter = Filter.And(
Filter.Eq(x => x.CompanyId, companyId),
Filter.Eq(x => x.DepartureProviderUniqueValue, departureValue),
Filter.Eq(x => x.ArrivalProviderUniqueValue, arrivalValue),
Now If a condition is met I want to extend the query I did it like this
if(date > DateTime.Min)
{
filter= Filter.And(filter, Filter.Eq(x => x.DepartureDate, date));
}
but When I run the query it behaves like the first conditions were concated with an OR instead of a AND. I would understand it would behave like a nested clause, but as all conditions are connected with AND.
Any explanations? What am I doing wrong?