I have an abstract base class called Party. There are several concrete subclasses (Company, Person, Department). Party has a property called PartyType which is use as the discriminator. Each type is in its own table with configurations like
Map<Person>(p => p.Requires("PartyType").HasValue("Person").ToTable("People");
Everything works well.
Now I want to add a subclass of Person called Employee. How do I map this? I’ve tried
Map<Employee>(e => e.Requires("PartyType").HasValue("Employee")
.ToTable("Employees");
but this gives a runtime error of
(43,10) : error 3032: Problem in mapping fragments starting at lines
43, 84:EntityTypes WOL.EFData.Person, WOL.EFData.Employee are being
mapped to the same rows in table People. Mapping conditions can be
used to distinguish the rows that these types are mapped to.
In table per type mapping EF does not expect a discriminator configuration.
See this article for more information.