I am trying to do something similar to using a lambda query inside a WCF operation parameter. I know there is no way to achieve this as lambda expressions are run-time and they can not be used in this way, but I think there are some solutions for this. My first idea is to use some search criteria class so that I can populate this class and then use it on server-side to build a lambda expression. My thoughts on a simple implementation for this class is something like :
public class PersonSearchCriteria
{
public string FirstName {get; set;}
public string LastName {get; set;}
public int IdCardNumber {get; set;}
Expression<Func<TSource, bool>> predicate
}
This is some pseudo code. I want to be able to create an instance of this class and based on this properties values' filter my database in my databasecontext (which in this case is EntityFramework 4.0 with selft tracking entities).