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

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -