How to do this Date is empty & Date is not empty
in System.Linq.Dynamic.Core,
I am currently doing this that is not working:
if (filter.Operator.StartsWith("is empty") ||
filter.Operator.StartsWith("is not empty"))
{
filterOp = filter.Operator.StartsWith("is not") ? "!=" : "==";
qs = $"{filter.Column.PropertyName} {filterOp} ''";
}
query = query.Where(qs);
Answering bunch of your questions to help your job done this year.
is it possible to convert lambda function to string for use in system.linq.dynamic.core expression
How to convert Func<T, bool> to Expression<Func<T, bool>>
MudBlazor
already can build filter expression and no additional crutches likeDynamic.LINQ
are needed. I have checked this code and it should work with EF Core.There is function:
So, basically you can use this function in the following way:
And if you have list of these defintitions, you can create helper function which apply this list to any
IQueryable
Answering the following comment:
Extension method
ToQueryString()
you can call ONLY whenIQueryable
started fromDbSet
, it is not applicable toIQueryable
created fromIEnumerable
by callingAsQueryable()
. TheseIQueryable
has differentProvider
andToQueryString()
expects that this provider is specific EF Core provider.