I'm having a problem when I attempt to create a generic List using a POCO within a LINQ query that creates another POCO:
var user =
from u in ctx.users
select new User
{
id = u.UserID,
name = u.Name,
roles = u.Roles.ToList()
};
I have created both a User and Role class. If I define 'roles' in User as:
public List<Roles> roles;
I have no problem. This is using the Entities Roles object however, and I'd rather use my own Role POCO:
public List<Role> roles;
However this throws the following error:
Error 3 Cannot convert lambda expression to type 'string' because it is not a delegate type
How exactly do I use my POCO rather than the Entity object?