With Entity Framework I can map related tables as a class inheritance and There are three different approaches to representing an inheritance hierarchy (by weblogs):
- Table per Hierarchy (TPH)
- Table per Type (TPT)
- Table per Concrete class (TPC)
The site mscblogs has a nice explanation for each one of these approaches.
I'm trying to understand how to map my tables using the approach TPT (Table per Type), but unlike the example of mscblogs, I need to do the mapping for fluent programming like:
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
public class BillingDetailMap : EntityTypeConfiguration<BillingDetailEntity>
{
public BillingDetailMap()
{
// ...
this.Property(t => t.Number).HasColumnName("Number");
// ...
}
}
// ...
I'm searching for several hours but I couldn't find anything. I found many examples how to do this with diagram, with attributes and others, but nothing with fluent api.
How to Mapping TPT in Entity Framework 4.1 Fluent API?