Currently dynamic linq operators created using System.Linq.Expressions.Expression object do not support sql "IN" operator, there is a way to implement it however, just add a simple expression building tree like in the example here:
Reference:
http://stackoverflow.com/questions/6907103/how-to-create-a-dynamic-contains-or-like-expression-to-be-used-with-linq-again
pe =
Expression.Parameter(typeof(myClient), "clt"); PropertyInfo propertyInfo
= typeof(myClient).GetProperty("PropertyFieldName"); MemberExpression m
= Expression.MakeMemberAccess(pe, propertyInfo); ConstantExpression c =
Expression.Constant("SearchFrase", typeof(string)); MethodInfo mi =
typeof(string).GetMethod("Contains", new Type[] { typeof(string) }); e1 =
exp.Expression.Call(m, mi, c);
Reference:
http://stackoverflow.com/questions/6907103/how-to-create-a-dynamic-contains-or-like-expression-to-be-used-with-linq-again
No comments:
Post a Comment