我正在使用这样的ef-core继承:
public abstract class Person
{
public int Id { get; set; }
public string Name { get; set; }
public PersonType PersonType { get; set; }
public int PersonTypeId { get; set; }
public double Height { get; set; }
[Timestamp]
public byte[] Timestamp { get; set; }
}
public class Daughter : Person
{
public double Weigth { get; set; }
public DateTime SomeDate { get; set; }
}
public abstract class Son : Person
{
public DateTime BirthDate { get; set; }
public DateTime GraduationDate { get; set; }
}
public class SingleSon : Son
{
}
public class SonWithDaughter : Son
{
public int Daughter { get; set; }
public Daughter Daughter { get; set; }
}
在DbContext中:
public DbSet<PersonType> PersonTypes { get; set; }
public DbSet<Daughter> Daughters { get; set; }
public DbSet<SingleSon> SingleSons { get; set; }
public DbSet<SonWithDaughter> SonWithDaughters { get; set; }
当我更新sql server数据库(dotnet ef数据库更新)时,它会抛出一个
System.InvalidOperationException,Sequence包含多个 匹配元素
关于如何解决这个问题的任何想法?
更新