mam ten model i konfiguracjęjednostka po raz pierwszy kod framework - Unia z dwóch pól w jednej kolekcji
public class Person
{
public int? FatherId { get; set; }
public virtual Person Father { get; set; }
public int? MotherId { get; set; }
public virtual Person Mother { get; set; }
public virtual List<Person> Childs { get; set; }
}
class PersonConfiguration : EntityTypeConfiguration<Person>
{
public PersonConfiguration()
{
HasOptional(e => e.Father).WithMany(e => e.Childs)
.HasForeignKey(e => e.FatherId);
HasOptional(e => e.Mother).WithMany(e => e.Childs)
.HasForeignKey(e => e.MotherId);
}
}
i ja dostać ten błąd, gdzie typ jest początkowy.
Podany schemat jest nieprawidłowy. Błędy: (151,6): error 0040: Type Person_Father nie jest zdefiniowany w przestrzeni nazw ExamModel (Alias = Self).
Czy istnieje sposób na mapowanie właściwości Childs
według obu właściwości (motherId i fatherId)?