Consider the following:
var modelBuilder = new AdventureWorksModelBuilder();
modelBuilder.Entity<AbsInMiddle>().ToTable("Base");
// PROBLEM LINE BELOW
//modelBuilder.Entity<AbsInMiddleL1>();
modelBuilder.Entity<AbsInMiddleL2>()
.Map(
mc =>
{
mc.ToTable("L2");
mc.MapInheritedProperties();
});
var databaseMapping = BuildMapping(modelBuilder);
databaseMapping.Assert<AbsInMiddle>("Base").HasColumns("Id", "Data");
If the third line remains commented out then the test passes but if it is uncommented if will fail because mapping will incorrectly include an extra column in the "Base" table.
This is likely happening because the 3rd line will create an EntityTypeConfiguration for AbsInMiddleL1, which is causing something weird to happen in mapping configuration.
This is a bigger issue now that we have Lightweight Conventions because it becomes much easier to trigger creation of EntityTypeConfigurations for abstract entity types.
var modelBuilder = new AdventureWorksModelBuilder();
modelBuilder.Entity<AbsInMiddle>().ToTable("Base");
// PROBLEM LINE BELOW
//modelBuilder.Entity<AbsInMiddleL1>();
modelBuilder.Entity<AbsInMiddleL2>()
.Map(
mc =>
{
mc.ToTable("L2");
mc.MapInheritedProperties();
});
var databaseMapping = BuildMapping(modelBuilder);
databaseMapping.Assert<AbsInMiddle>("Base").HasColumns("Id", "Data");
If the third line remains commented out then the test passes but if it is uncommented if will fail because mapping will incorrectly include an extra column in the "Base" table.
This is likely happening because the 3rd line will create an EntityTypeConfiguration for AbsInMiddleL1, which is causing something weird to happen in mapping configuration.
This is a bigger issue now that we have Lightweight Conventions because it becomes much easier to trigger creation of EntityTypeConfigurations for abstract entity types.