Second Self-To-Self relationship in Entity Framework
-
07-11-2019 - |
문제
Assume we have a domain class
public class Incident
{
[Key]
public virtual int IncidentId { get; set; }
[Display(Name = "Parent Incident")]
public virtual Incident ParentIncident { get; set; }
[Display(Name = "Related Claim")]
public virtual Incident ClaimIncident { get; set; }
}
Other properties are omitted for simplicity.
When I had just ParentIncident
in place, everything worked fine. Now I have added ClaimIncident
to the class. I am attempting to update my database using the Entity Framework 4.3 (PreRelease) Migrations
option, but I am getting an error, that EF doesn't know how to map Incident to Incident.
Why referencing the same class instance once is allowed per class, and when I introduce the second one, it suddenly has no clue of how to reference it? And how can I correct the model class?
올바른 솔루션이 없습니다
제휴하지 않습니다 StackOverflow