I am trying to design a Class Diagram with the intention of using it to generate and maintain the database, and generate .NET classes in Entity Framework (preferably Core, but it looks like it doesn’t support Model First no matter who’s third party tools you use). Our desired structure has pretty much every class inheriting from an abstract base class that itself has other abstract base classes. Sometimes we get to a concrete class, and we want everything to be Table per Concrete Class, so that all fields end up in a single table per sub-class. However, sometimes we get to a class that is still abstract, but all of it’s sub-classes are to be Table per Class Hierarchy, so there is a discriminator, and all sub-classes are in the same table.
Suppose you had an abstract class Thing, which had an abstract sub-class Mammal, which had concrete classes Cat and Human. Our system isn’t about Mammals, so the differences between different sub-classes are minimal. Sometimes I want a field in an Entity that can be any kind of Mammal, and sometimes I want one that can only be a Cat, so it makes sense to have all sub-classes of Mammal in one table. But we have other Things, like Vehicle and House, and we have lots of details about them that are different, and no sub-classes of them, and we never just reference a Thing. We want each one of those to be in their own table. In all cases, we don’t want a Thing table. All the fields of Thing are in all derived tables.
However, there is a NOTE in the Inheritance Strategies page (https://www.visual-paradigm.com/support/documents/vpuserguide/3563/3564/85388_differentinh.html) that says that is only possible in Java, and .NET can’t mix inheritance types “within a generalization hierarchy”. Am I reading that correctly? Does that phrase mean that what I’m trying to do won’t work? If so, is it something that is being worked on? Is there a workaround? Can it be overcome with some custom generation coding?