Hello
I have lots of extended "filters" such as this one:
public static IQueryable<Customer> ByCustomerID(this IQueryable<Customer> qry, int customerID)
{
return from c in qry
where c.CustomerID == customerID
select c;
}
To GetCustomers() (IQueryable), such as .ByCompanyID() etc etc, and I would like to add those filters depending on criterias.
Kinda like:
var result = _rep.GetCustomers();
if(useByCompanyID)
// add .ByCompanyID(companyID) to "result"
if(useByCountry)
// add .ByCountry(country) to "result"
// etc etc....
//do something with "result"
is that possible to do using the entity framework and linq?
/M