Some of these subclasses have a navigation property, referencing another entity - each subclass references a different type of entity.
To consolidate the schema, I use a single column called EntityId - and each of the subtypes map their navigation-properties to that same column.
In this particular case, one subtype references a Contact entity, while another subtype references a Role entity - and the generated constraints are as follows:
Code: Select all
CONSTRAINT FK_TaskAssociation_Contact_1 FOREIGN KEY (EntityId) REFERENCES dbo.Contact (Id), CONSTRAINT FK_TaskAssociation_Role_2 FOREIGN KEY (EntityId) REFERENCES dbo.Role (Id)
(this may come back to a problem I've highlighted on multiple occasions - the fact that each of these distinct navigation-properties, despite mapping to the same physical foreign-key column in the database, have their own unique column-specifications...)