I\'m using the Mono.CSharp library to emit code. Following another question on SO (http://stackoverflow.com/questions/3407318/mono-compiler-as-a-service-mcs) I managed to g
I didn't try this, but I guess you could use Mono compiler to create a delegate vthat takes IQueryable
as argument and returns the filtered query. Something like:
IQueryable contacts = GetContacts();
string query = "new Func, IQueryable>(contracts =>
from contact in contacts
where contact.Name == \"name\"
select contact)";
var res = Mono.CSharp.Evaluator.Evaluate(query);
Then you just need to cast res
to an appropriate Func<,>
type and invoke it to get the result.