Hello i have 3 classes Person, UserProfile(it inherits Person) and Results, a Person can have one or more results, when i try to add i a result to a person a i get the error
Are you trying to add the same Result
to several users?
In that case this will fail because entity framework will realize the Results
collection of the Person
class as a foreign key from Results
to Persons
. The mapping will be the same as if you add a Person
navigation property to the Result
class.
If you want Person
and Result
to have a many-to-many relationship you have to add a ICollection<Person> Persons
property to the Results
class to make EF understand that.