List to EntityCollection

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

I have the following:

user.Roles = new List<Role> { new Role { Id = 1 }, new Role { Id =
2} };

But I get the following error:

Cannot implicitly convert type
'System.Collections.Generic.List<Role>' to
'System.Data.Objects.DataClasses.EntityCollection<Role>'

Is there a way to fill user.Roles in one code line?

Thanks,
Miguel
 
Back
Top