> do all these stuff in your ApplicationServices and don't use NHV-events in > production.
Sorry, I'm not quite sure what your saying here... I suspect you mean to say: "Look, that's crappy design"... If that's true then your right... However, this particular application suffers from quite a few issues... One of the clients is using all MS Datasets, lots of custom attributes on said datasets... basically we don't want to make changes to field lengths for any reason until we have the cycles to really deal with the implications... What I've settled on is to create a truncated user type of such: http://wordpress.primordialcode.com/index.php/2010/03/26/nhibernate-custom-parametric-usertype-truncate-strings/ There's really only one field that's problematic (but it's on every table) where I absolutely need this... I'll use NHValidator for everything else and log the exceptions, at least then I can tell the UI people where their stuff needs to be cleaned up... Any thoughts appreciated. G On Dec 17, 1:59 pm, Fabio Maulo <[email protected]> wrote: > 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%252bunsubscr...@googlegroup > > s.com>> > > > > . > > > > 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.
