I want to run dynamic linq with a string where clause like this:
query = db.Customers.Where("Categories.Any(Code == 'Retail')");
Customer entity has collection of categories
class Customer
{
public List<Category> Categories {get;set;}
...
}
class Category
{
public Guid Id {get;set;}
public string Code {get;set;}
}
Can anyone please tell me is it possible to do something like this?
PS: I need where clause be string. The where clause will be generated at runtime, for this reason I can't use Linq query expression.
I'm using Telerik DataAccess.
Expression
for this. Probably you need some builder to build your string query to Expression tree. – Blithesome