c# - Get a list of elements by their ID in entity framework -
how can elements in list id? eg; have list roles; i'd roles database in this list id.
i'm using code-first.
i did , threw error:
var roles = db.roles.where(r => user.roles.any(ur => ur.roleid == r.roleid)); roleid of type int.
error:
unable create constant value of type 'samplemvc.domain.role'. primitive types ('such int32, string, , guid') supported in context.
var listofroleid = user.roles.select(r => r.roleid); var roles = db.roles.where(r => listofroleid.contains(r.roleid));
Comments
Post a Comment