Hi All,

I was wondering if AR/NH had the ability to prevent a parent entity being
deleted if it has existing relationships with children entities? 

The logic behind the question is that I have an aggregate root called
Project, which has a ManyToOne relationship with ProjectAttribute (amongst
other relationships). ProjectAttribute has various properties that are the
reason for this separation, but it could for all intents just have Code and
Description properties.

If a Project is deleted, the deletion is not cascaded down to the
ProjectAttribute as it is a reusable entity independent of Project, and in
these circumstances acts as the parent in the relationship (I assume).

However I would like to prevent ProjectAttribute from being deleted if it
exists on a Project. Currently this is controlled via a FK constraint on the
database, but I'd prefer not to rely on that.

Can AR/NH handle this responsibility for me, or must I rely on custom checks
in my delete code and/or database constraints for this?

I have played around with various Cascade and Inverse combinations, but
nothing leads to controlling this with anything other than an FK constraint
SQL exception.

Thanks
Nick


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to