.net - Convert Func(Of Type, Boolean) to Expression(Of Func(Of Type, Boolean))? -


i've got following code:

dim query iqueryable(of someobject) =      new objectquery(of someobject)(querystring, db, mergeoption.notracking)         .where(ctype(function(x) x.publish = true,                      expression(of func(of someobject, boolean)))) 

and gives me error says:

cannot convert expression of type func(someobject) system.nullable(of boolean) type system.linq.expressions.expression(of system.func(someobject, boolean)).

i have tried:

 .where(ctype(function(x) x.publish = true,                      expression(of func(of someobject, nullable(of boolean))))) 

which doesn't work either.

if don't have ctype where comes narrowing conversion error iqueryable , ienumerable, need there, not sure how write parameter expression can converted. help?

don't use casting ctype here - create expression directly:

dim expr expression(of func(of someobject, nullable(of boolean))) =     function(x) x.publish = true  dim query iqueryable(of someobject) =      new objectquery(of someobject)(querystring, db, mergeoption.notracking)         .where(expr) 

expressions need created such. it's not possible convert existing func expression.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -