You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I run in to a number of situations where I want to share an object type across multiple parents.. Could be a Contact, Address, Image&MetaData. I would like support for a "shared" entity.. one that is based on a parent ID and discriminator.. While navigating from the child (Contact, address, image, etc) to the parent would be non-trivial, the vast majority of the time this use case is from the parent to a collection of children. Currently without adding a bunch of one off inherited objects and a nullable FK for each parent type this is not doable, and that approach is disliked by many a DBA..
Ideal use case:
Contact:
Id
ParentId
ParentDiscriminator
[the rest of the fields that make up a contact]
Customer:
Id
Fields that make up a customer
ICollection Contacts
Supplier:
Id
Fields that make up a supplier
ICollection Contacts
Partner:
Id
Fields that make up a partner
ICollection Contacts
Warehouse:
Id
Fields that make up a partner
ICollection Contacts
etc... Currently the best I can do is create a ContactBase, then a contact per parent, and that adds an FK per parent to the database model. And that approach just seems overly complicated, causes code bloat (if a contact is truly is identical every time) and adds fields and un-needed indexes to the database.
Thanks
The text was updated successfully, but these errors were encountered:
I run in to a number of situations where I want to share an object type across multiple parents.. Could be a Contact, Address, Image&MetaData. I would like support for a "shared" entity.. one that is based on a parent ID and discriminator.. While navigating from the child (Contact, address, image, etc) to the parent would be non-trivial, the vast majority of the time this use case is from the parent to a collection of children. Currently without adding a bunch of one off inherited objects and a nullable FK for each parent type this is not doable, and that approach is disliked by many a DBA..
Ideal use case:
Contact:
Customer:
Supplier:
Partner:
Warehouse:
etc... Currently the best I can do is create a ContactBase, then a contact per parent, and that adds an FK per parent to the database model. And that approach just seems overly complicated, causes code bloat (if a contact is truly is identical every time) and adds fields and un-needed indexes to the database.
Thanks
The text was updated successfully, but these errors were encountered: