In my hierarchy of animals
Base one:
public class AnimalMap : ClassMap<Animal>
{
public AnimalMap()
{
Schema("dbo");
Table("Animals");
Id(x => x.Id).Column("ID").GeneratedBy.Identity();
Map(x => x.FoodClassification).Column("FoodClassification");
Map(x => x.BirthDate).Column("BirthDate");
Map(x => x.Family).Column("Family");
DiscriminateSubClassesOnColumn("ClassType").Not.Nullable();
}
}
One subclass:
public class DogMap : SubclassMap<Dog>
{
public DogMap()
{
DiscriminatorValue(@"Dog");
Map(x => x.Field).Column("Field");
}
}
So the question is:
Where column "ClassType" != Dog , Animal should be object type, like base one. Each one who has no mapping class should have base(super) one.
How to make it works?
important: only do this to support legacy schemas and animal is readonly