Anyway to wrap this into a `Expression`
royberris opened this issue · 3 comments
Hi, thanks for this package it's very useful. So the predicate returend is of type Func<>
which is not suitable when trying to execute this in SQL server.
What i am trying to ask is if there is any way to create a Expression<Func<T, bool>>
from this package? So I can call it on SQL server instead of evaluating client side.
Hello,
Which method are you calling that returns a Func
? They all return an Expression<..>
that needs to be compiled or used by IQueryable
.
Hey, I haven't yet implemented this yet but I was looking at the examples. In one place you have
var products = _dbContext.Products.AsQueryable().Where(predicate).ToList();
But doesn't the AsQueryable()
mean it will be evaluated client side?
Nope, that example uses a DbSet from Entity Framework, AsQueryable
is only used to turn that dbset into a queryable, then the predicate is applied to it. Ef will be the one executing the request in the database provider.