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
Post a Comment