Given an entity A ("master") which have childs of type Q ("detail" ) it would be nice when a user try to delete some A instance, to know in advance which action will take the RDBM: if it´s CASCADE or SET NULL, then it´s OK to delete; but if it´s RESTRICT the app must get the EntitySet.Count, and allow the deletion only if Count is zero. How is it possible with DataObjects? I can see the ForeignKeyConstraintActions enum, but cannot figure how to set/get the corresponding value for every association an entity can have. TIA

asked Oct 02 '18 at 13:02

_marcelo_'s gravatar image

_marcelo_
5112


One Answer:

Hello _marcelo_,

I am not sure I understood correctly what you want As I got it, you need certain mechanism to restrict deletion if any there is references to the deleting entity. Correct me if I have misunderstood you.

DataObjects.Net has settings for associations - AssociationAttribute.OnOwnerRemove and AssociationAttribute.OnTargetRemove allow you to specify certain type of action on deletion of owner entity or target entity. You can read about these properties here in section "Referential integrity and business rules"

answered Oct 03 '18 at 08:21

Alexey%20Kulakov's gravatar image

Alexey Kulakov
77225

You understood it exactly. My question is answered. Thank you.

(Oct 03 '18 at 09:50) _marcelo_ _marcelo_'s gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×9

Asked: Oct 02 '18 at 13:02

Seen: 2,226 times

Last updated: Oct 03 '18 at 09:50

powered by OSQA