Sequence contains more than one matching element on schema update

asp.net-core entity-framework entity-framework-core inheritance

Question

I´m using ef-core inheritance like this:

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; }
}

In 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; }

When I update sql server database (dotnet ef database update) it throws a

System.InvalidOperationException, Sequence contains more than one matching element

Any ideas about how to solve this?

UPDATE

ef migrations console output

1
0
8/30/2016 7:58:51 PM

Accepted Answer

This is issue #5894. It will be fixed in version 1.0.1. Until that's released, you can use the nightly feed.

1
8/30/2016 8:39:27 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow