What Fabio is trying to say is that you shouldn't spend time trying to protect the API as if it is under attack
On Fri, Dec 19, 2008 at 8:07 AM, epitka <[email protected]> wrote: > > Fabio, I really don't know what to make of your answer. > > On Dec 19, 6:45 am, "Fabio Maulo" <[email protected]> wrote: > > epitka... we have another concept....Who are using your class is your > friend > > and he is not a terrorist. > > > > 2008/12/19 epitka <[email protected]> > > > > > > > > > > > > > But how do you protect your collection from being changed; exposing it > > > as read-only? But that is not intuitive, if client does not know that > > > AddPerson is to be used you would get exception. > > > Why is #2 not viable? > > > > > On Dec 18, 9:29 pm, "Greg Young" <[email protected]> wrote: > > > > 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. > > > > -- > > Fabio Maulo > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
