do all these stuff in your ApplicationServices and don't use NHV-events in
production.

On Fri, Dec 17, 2010 at 6:31 PM, gary lucas <[email protected]> wrote:

> Actually, and one more question.
>
> Do you think this scenario is possible:
> 1) Set up nhvalidate
> 2) On generic update / save
> 3) Catch failed validation from validate event
> (NHibernate.Validator.Event.ValidatePreUpdateEventListener)
> 3.1) Apply logic to class to fix the validation error and log event
> 4) Complete save...
>
> Or am I totally barking up the wrong tree...
>
> We're dealing with a bit of a mess and I'd ideally like to apply some
> failed validation rules... I would keep the rules in the message ie:
> "truncate:length=25"... The end result would be to save the truncated
> object and log an error...
>
> G
>
> On Dec 17, 1:03 pm, Fabio Maulo <[email protected]> wrote:
> > conf.Initialize(validatorEngine)
> > would be better
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Fri, Dec 17, 2010 at 5:54 PM, gary lucas <[email protected]>
> wrote:
> > > Figured it out:
> >
> > > NHibernate.Validator.Cfg.ValidatorInitializer.Initialize(conf);
> >
> > > G
> >
> > > On Dec 17, 10:42 am, gary lucas <[email protected]> wrote:
> > > > First off, I have to say I'm not sure exactly how this is supposed to
> > > > work.
> >
> > > > I've added a nhv.xml file, that doesn't seem to be an issue because
> > > > when I call:
> >
> > > > ValidatorEngine validator = new ValidatorEngine();
> >
> > > > validator.Configure();
> > > > bool isValid = validator.IsValid(object);
> >
> > > > Everything seems to work as expected, however I'm assuming that when
> I
> > > > call an update with an object that is invalid I should get an
> > > > exception...
> > > > "If a constraint is violated, the event will raise a runtime
> > > > InvalidStateException which contains an array of InvalidValues
> > > > describing each failure."
> >
> > > > However I'm just getting the regular SQL exception ('Couldn't insert
> x
> > > > into y') etc...
> >
> > > > My configuration specifies:
> > > > <property name='autoregister_listeners'>true</property>
> >
> > > > Thank you,
> >
> > > > Gary
> >
> > > --
> > > 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
>
> --
> 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.
>
>


-- 
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.

Reply via email to