Reputation: 1751
I have a situation where I want to query an accounts table. I want all accounts except accounts where ParentId != null
as default.
I have tried the following with the predicate builder, but it does not take effect in the sql query. Any idea how to add the whereClause.And(a => a.ParentId != null);
check when using the LinqKit PredicateBuilder?
var whereClause = PredicateBuilder.New<VAccount>(true);
whereClause = whereClause.And(a => a.ParentId != null); // Not added to query
if (dto.OrganisationId != 0)
whereClause = whereClause.Or(a => a.OrganisationId == dto.OrganisationId);
// Other search inputs added etc..
Upvotes: 1
Views: 188