List to EntityCollection

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Linq query 3
Linq > Contains 2
Find Ints in List ... 4
Generics 7
Intersection of Lists 5
Add item at start 5
Sring[] to List<MyEnumeration> 5
List. Add, Remove. 1

Top