How to use predicates with LINQ to query CRM 2011 -
i trying use linqkit predicate. getting following code when trying compile.
public void testpredicate(guid[] productids) { var predicate = predicatebuilder.false<product>(); foreach (var productid in productids) { var tempguid = productid; predicate = predicate.or(p => p.productid== tempguid); } } var query = p in context.createquery("product") .asexpandable().where(predicate) select p; }
error 1: 'system.linq.iqueryable' not contain definition 'where' , best extension method overload 'system.linq.queryable.where(system.linq.iqueryable, system.linq.expressions.expression>)' has invalid arguments
error 2 argument 2: cannot convert 'system.linq.expressions.expression>' 'system.linq.expressions.expression>
please suggest me need fix it.
thanks
i believe using dynamics crm. following should work you.
var query = p in context.productset .asexpandable().where(predicate) select p;
Comments
Post a Comment