Consider a DB schema as follows
Animal
AnimalID
Name
Mammal
AnimalID
HairColour
Fish
AnimalID
ScalesKind
Walker
AnimalID
LegCount
Swimmer
AnimalID
MaxDepth
These tables are all able to be joined to one another via their AnimalID. For example a Shark is represented as:
Animal
AnimalID = 1
Name = Shark
Fish
AnimalID = 1
ScalesKind = Placoid
Swimmer
AnimalID = 1
MaxDepth = 2000
A monkey is represented as
Animal
AnimalID = 2
Name = Monkey
Mammal
AnimalID = 2
HairColour = Brown
Walker
AnimalID = 2
LegCount = 2
While a swimming mammal such as Dolphin is represented as
Animal
AnimalID = 3
Name = Dolphin
Mammal
AnimalID = 3
HairColour = Bald
Swimmer
AnimalID = 3
MaxDepth = 300
If Delphi supported multiple inheritance I would implement a class hierarchy something like this
In my example since TSwimmer and TWalker represent behaviours you may be tempted to say they're better suited to being interfaces e.g. ISwimmer and IWalker, and I would agree that for this specific example they are. This is just a simplified example however and in the real application using interfaces is not as appropriate.
So I'm investigating whether I can write an Aurelius application against a schema such as the one I've described above. My idea was an Aurelius class structure as follows:
The most obvious potential issue is that the Swimmer table is mapped to both TSwimmingMammal and TSwimmingFish. Will Aurelius allow multiple classes to be mapped to the same table?
Assuming it does, what will happen if I ask for a list of TSwimmingMammals? Will I get just the Dolphin or will it also return the Shark? Any other gotchas?
Thanks very much,
Lachlan