The problem was with the SharedEngineProvider;

Environment.SharedEngineProvider = new BasicSharedEngineProvider(engine);

http://nhforge.org/wikis/howtonh/setup-nhv-fluently-with-your-ioc-container.aspx

2010/7/9 José F. Romaniello <[email protected]>

> what about
>  var nhibernateCfg = new Configuration();
>  nhibernateCfg.Initialize(validatorEngine);
>  nhibernateCfg.Configure();
>
> (call configure after initialize)
>
> On 9 jul, 18:38, Jason Dentler <[email protected]> wrote:
> > I've run in to some trouble with the NHibernate integration when using
> the
> > fluent configuration syntax. Here is my configuration.
> >
> >       var validationCfg = new FluentConfiguration();
> >       validationCfg.Register(new[] {typeof (ProductValidator)})
> >         .SetDefaultValidatorMode(ValidatorMode.UseExternal)
> >         .IntegrateWithNHibernate
> >           .ApplyingDDLConstraints().And
> >           .RegisteringListeners();
> >
> >       var validatorEngine = new ValidatorEngine();
> >       validatorEngine.Configure(validationCfg);
> >
> >       var nhibernateCfg = new Configuration().Configure();
> >       nhibernateCfg.Initialize(validatorEngine);
> >
> > I can use validatorEngine.Validate and get the expected validation
> errors,
> > so nhv is configured properly. Also, the nhv constraints are included
> with
> > hbm2ddl. However, an attempt to save an invalid entity goes all the way
> to
> > the database and throws a SqlException for the constraint violation. I
> was
> > expecting the nhv event listeners to throw an InvalidStateException.
> >
> > To add a twist to this puzzle, with the debugger, I can see the nhv event
> > listeners on my configuration object.
> >
> > Any ideas?
> >
> > Thanks,
> > Jason
>
> --
> You received this message because you are subscribed to the Google Groups
> "NHibernate Contrib - Development Group" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhcdevs%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhcdevs?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"NHibernate Contrib - Development Group" 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/nhcdevs?hl=en.

Reply via email to