Ultimately, yes; but it is not easy, and you need to either:
- learn API Expression
- use the pre-deployed LINQ dynamic library (from sample loading)
If you want to go to the first option, you need to create your own lambdas; imagine, for example, that you have something like (something happens here ...):
<Filters>
<Add Prop="Foo">My filter value</Add>
</Filters>
Then you will need to do something like:
XElement filters = ...;
IQueryable<Customer> query = ...;
foreach(var filter in filters.Elements("Add")) {
var param = Expression.Parameter(typeof(Customer), "row");
var body = Expression.Equal(
Expression.PropertyOrField(param, (string)filter.Attribute("Prop")),
Expression.Constant(filter.Value, typeof(string)));
query = query.Where(Expression.Lambda<Func<Customer, bool>>(
body, param));
}
( "" ) , ( , , , ..). , . , query .