So I have Products class that represent the products table.
To get all the records I do:
db.Products.ToList()
And I have a string like this:
String queryString = "mp=5 AND optic=TRUE AND price=500";
My question is how can I use this string to filter Products? Where func only accept lambda expressions..
Thanks
I’m not sure if it’s still supported or not, but you can use Dynamic LINQ to allow you to add ‘text’ based expressions as you require. See:
You may also want to think about using a Predicate builder to do the same job more declaratively. There are a few out there, but one that I’ve used with great success is the albahari one:
hope this helps..