Reputation: 14777
Hierarchy:
In terms of EF CF, all three tables have a one-to-one relationship. Have I selected the right composition to cater to the following scenario?
Scenario:
In other words, as soon as a Package request comes in, a ServerPackage AND a ClientPackage should be created. I am assuming this will not work since I need both packages to be tied to the same abstract Package Id.
Should I be using composition instead of inheritance and force a one-to-one relationship?
Please advise.
Upvotes: 1
Views: 416
Reputation: 364249
It will work only if all your packages are same instance => when the server receives request it must immediately create ClientPackage
. It cannot create Package
because Package
is abstract and if it only creates ServerPackage
you will not be able to create ClientPackage
with the same Id. So it looks like whole your inheritance will be redundant in such scenario.
If you want to follow your workflow you need composition.
Upvotes: 1