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

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -