Closed ds2307 closed 1 year ago
No, TPT is not supported.
Thank you for the quick response. Is there any workaround?
It depends on query which you are tying to execute.
Simplified example:
public abstract class A
{
public Guid Id { get; set; }
public string Value1 { get; set; }
}
public class B : A
{
public string Value2 { get; set; }
}
public class C : A
{
public string Value3 { get; set; }
}
public class ApplicationDbContext : DbContext
{
public DbSet<A> A => Set<A>();
public DbSet<B> B => Set<B>();
public DbSet<C> C => Set<C>();
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<A>().UseTptMappingStrategy();
}
}
I want execute dbContext.C.Select( x => new { x.Value3 } )
, and I get an exception
Inheritance Discriminator is not defined for the 'A' hierarchy.
Not sure that workaround exists. Your query is simple, why do you use linq2db
translation then?
This is just a basic example. In reality, I use a more complex query. In any case, thanks for the replies. I'll close issue.
Is TPT (table per type) supported?