Please, note the question is about EF Core and not EF4 or EF6.
I have this structure:
public abstract class Account {}
public class Customer : Account {}
public abstract class Supplier : Account {}
public class Company : Supplier {}
public class Private : Supplier {}
I want to generate something like this:
I have configured Entity Framework like this:
modelBuilder.Entity<Account>(entity =>
{
entity.ToTable("accounts");
entity.HasNoDiscriminator();
}
modelBuilder.Entity<Supplier>(entity =>
{
entity.ToTable("suppliers", "fco");
entity.HasDiscriminator<string>("supplier_type")
.HasValue<Company>("company")
.HasValue<Private>("private");
}
modelBuilder.Entity<Customer>(entity =>
{
entity.ToTable("customers", "cso");
}
But I Get this error:
'Customer' is mapped to the table 'cso.customers' while 'Account' is mapped to the table 'accounts'. Map all the entity types in the hierarchy to the same table, or remove the discriminator and map them all to different tables. See https://go.microsoft.com/fwlink/?linkid=2130430 for more information.
But it is what I want to.
If I modify to manage all as Table-Per-Type, it works. But it is not what I want.
Is it possible to obtain what I need?
Thank you
