I am writing my code as suggested,
public class A
{
public int id {get;set;}
public string Astring {get;set;}
}
public class B : A
{
public string Bstring {get;set;}
}
builder.Entity<A>().MapHierarchy( u=> new { ... }).ToTable("A");
builder.Entity<B>().MapHierarchy( u=> new { ... }).ToTable("B");
... = I have all the properties mentiond and u.Id in both.
I also have DbSet<A> A {get;set;}
and DbSet<B> B {get;set;}
and ObjectSet
properties for both when I use Model builder
builder.Entity<A>
builder.Entity<B>
This results in Table A being created with a discriminator column and Id, Astring, Bstring. This is the default TPH mapping, not sure why this is happening. Thanks