I'm building a search which will search multiple tables in our database, based on configuration. I'm getting the expression tree built, but when it comes to building the Expression Lambda, I'm getting stuck. I have:
var condExpr = Expression.Lambda<Func<Client, bool>>(expression, param);
But I don't know compile time whether I'm looking at a Client, Supplier, or some other entity. The application has plugins, so even the types that are available are unknown at compile time.
I do have a System.Type for the entity. How can I derive the generic type from that?
p.s. I have tried
var condExpr = Expression.Lambda(expression, param);
and it didn't work.
condExpr gets passed to the IQueryable result in the form of:
foreach (var b in dataResult.Where(condExpr))