NHValidator does not construct the class. If you have restrictions in your domain then you should avoid constructing an invalid object.
NHValidator will tell you if the object is valid or not, it won't stop you from creating it. Gustavo. On Thu, Dec 24, 2009 at 1:24 AM, schlachtzeuger <[email protected]>wrote: > so then a address setter is a public method and should protect itself > from wrong usage and validate the incoming address, right? > > but how does this pattern fits with nh validator? > > On Dec 23, 11:56 pm, Fabio Maulo <[email protected]> wrote: > > each public method should protect itself by wrong usage. > > If you have a method to send e-mails that method should check if each > > address is valid no matter from where the address is coming (userWelcome, > > Order accepted, Incoming message from other user and so on). > > > > 2009/12/23 schlachtzeuger <[email protected]> > > > > > > > > > > > > > josé, pls read carefully, i don't send emails in set properties, i > > > raise events in my domain entities and its properties, and no, i don't > > > think that this is wrong design. > > > > > according to you, is it the recommanded usage of nh validator that a > > > subscriber (mybe in a totaly different tier) should validate the > > > entity before sending the email? > > > > > or is it the recommanded usage to validate in each place (mybe > > > property) in the entity before side effects occur (mybe sending > > > emails) ? > > > > > On Dec 23, 7:24 pm, José F. Romaniello <[email protected]> wrote: > > > > Well.. it's a wrong design. A set property that send a mail??? > > > > > > Check if the entity/property is valid before send the mail. > > > > > > 2009/12/23 schlachtzeuger <[email protected]> > > > > > > > with nh validator we can define a property eg as not nullable. > > > > > despite > > > > > this definition we can call the setter of that property with a null > > > > > value argument. but if we then call IsValid, we know that the > > > > > operation was invalid. > > > > > > > if that property triggers some other events in our domain, eg > raises > > > > > a > > > > > property changed event and that event causes a subscriber to send > > > > > notification emails, we'll get into troubles. this is just one > > > > > example > > > > > but the problem is, that we can execute operations which invalidate > > > > > our domain entities and afterwards we check if that operation was > > > > > valid. > > > > > > > what is the recommended usage of nh validator to avoid these > problems? > > > > > > > -- > > > > > > > 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]<nhusers%[email protected]> > <nhusers%[email protected]<nhusers%[email protected]> > > > > > <nhusers%[email protected]<nhusers%[email protected]> > <nhusers%252bunsubscr...@googlegroups.com> > > > > > > > > > . > > > > > For more options, visit this group at > > > > >http://groups.google.com/group/nhusers?hl=en.-Hide quoted text - > > > > > > - Show quoted text - > > > > > -- > > > > > 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]<nhusers%[email protected]> > <nhusers%[email protected]<nhusers%[email protected]> > > > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/nhusers?hl=en. > > > > -- > > Fabio Maulo- Hide quoted text - > > > > - Show quoted text - > > -- > > 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]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > > -- 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.
