c# - migrating to dbcontext LINQ where clause string parameter -


i'm migrating project objectcontext dbcontext , have problem sentence:

var query = db.inventory.where("it.idstate in {" + states + "}"); 

this works objectcontext error @ compilation time:

error   cs1503  argument 2: cannot convert 'string' 'system.linq.expressions.expression<system.func<test.dal.inventory, bool>>'  

seems not posible now, tryied expose objectcontext it, couldn't find way

any idea? thank!

you can (and should) type these arguments expression.

var query = db.inventory.where(x => states.contains(x.idstate)); 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -