I need to extract some records if some variables have some values.
For example, if status>0 I need to filter result like :
where object.id=status
else, if status=0, I need to remove this where clauses and return all elements. I'll get rid about :
if(status>0)
do a linq query with the where clauses
else
do a link query with that where clauses
too much code, because the variables to check could be more than 4-5.
Is it possible to "inject" a sort of string on LINQ? (So i can create my string and pass it to the LINQ).
I mean somethings like :
string myQuery="";
if(status>0)
myQuery="where object.id=status";
else
myQuery="";
is it possible? (Classic mysql behaviour).