1. don't let collection be modified directly but use Add/remove and
enforce rule there

Have the aggregate root enforce the validation.

Cheers,

Greg

On Thu, Dec 18, 2008 at 7:25 PM, epitka <[email protected]> wrote:
>
> This is probably more a DDD question then NH. Let say you have
> observable collections that raise events before collection gets
> changed and after. Let's say you have a rule that only person's over
> 21 can be added to the collection. How would you handle this rule:
> 1. don't let collection be modified directly but use Add/remove and
> enforce rule there
> 2. create delegate that will check rule in OnChanging step and veto
> change
> 3. allow person to be added and run validate before persisting entity
> using NH events, basically allow entity to get into invalid state
> 4. manually invoke validation before commiting changes.
> 5. something else ?
>
> >
>



-- 
It is the mark of an educated mind to be able to entertain a thought
without accepting it.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" 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/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to