Sequence在架构更新中包含多个匹配元素

时间:2016-08-30 17:13:10

标签: entity-framework inheritance asp.net-core entity-framework-core

我正在使用这样的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包含多个   匹配元素

关于如何解决这个问题的任何想法?

更新

ef migrations console output

1 个答案:

答案 0 :(得分:1)

这是问题#5894。它将在版本1.0.1中修复。在发布之前,您可以使用the nightly feed