I am working on an asp.net core 2.0 mvc web application. I have an sql-server database.
I need to build a complex filter. Please note i have simplified the example bellow.
Func<PersonEntity, bool> expr1 = (x => x.email.Contains("value1");
Func<PersonEntity, bool> expr2 = (x => x.email.Contains("value2");
Func< PersonEntity, bool> filter1 = (x => expr1(x) || expr2(x));
bdd.persons.Where(x => x.id<100).Where(filter1);
The SQL query which is received by sql server is:
SELECT * FROM Persons WHERE id<100
I suppose that my dynamic filter filter1 is executed by C# code. What i want is to execute all filters in sql query. How can i do this ?
Thanks