That didn't work, but this did:
private static ValidatorEngine
ConfigureValidator(NHibernate.Cfg.Configuration nhibernateConfiguration)
{
NHibernate.Validator.Cfg.Environment.SharedEngineProvider
= new SharedValidatorProvider();
var nhvc = new NHVConfiguration();
nhvc.Properties[NHibernate.Validator.Cfg.Environment.ApplyToDDL] =
"true";
nhvc
.Properties
[NHibernate.Validator.Cfg.Environment.AutoregisterListeners] = "true";
nhvc.Properties[NHibernate.Validator.Cfg.Environment.ValidatorMode] =
"UseAttribute";
var ve = new ValidatorEngine();
ve.Configure(nhvc);
ValidatorInitializer.Initialize(nhibernateConfiguration,
ve);
return ve;
}
On Mar 10, 2009, at 3:18 PM, Brendan Erwin wrote:
> Does this seem right?
>
> private static ValidatorEngine
> ConfigureValidator(NHibernate.Cfg.Configuration
> nhibernateConfiguration)
> {
> var ve = new ValidatorEngine();
>
> NHibernate.Validator.Cfg.Environment.SharedEngineProvider = new
> SharedValidatorProvider();
> ValidatorInitializer.Initialize(nhibernateConfiguration,
> ve);
> return ve;
> }
>
> On Mar 10, 2009, at 2:51 PM, Fabio Maulo wrote:
>
>> The ValidatorEngine.Configure no but you said:
>> "I'm trying to get Validator to work with mappings created with
>> fluent-nhibernate."
>> and I thought it was ValidatorInitializer because there is not
>> another integration point between NH and NHV
>>
>> 2009/3/10 Brendan Erwin <[email protected]>
>> I'm missing something here. fluent-nhibernate does give me access
>> to the NHibernate Configuration before BuildSessionFactory but I
>> don't see what to do with it. The ValidatorEngine.Configure method
>> does not take an instance of NHibernate.Cfg.Configuration.
>>
>>
>> On Mar 10, 2009, at 2:11 PM, Fabio Maulo wrote:
>>
>>> FNH should give you something before BuildSessionFactory.
>>> something = the configuration with all mappings added.
>>>
>>> Then you have a full integration.
>>>
>>> P.S. take a look to Loquacious
>>> (http://fabiomaulo.blogspot.com/2009/02/nhibernatevalidator-fluent-interface.html
>>>
>>> )
>>> Available on NHV trunk.
>>>
>>> 2009/3/10 brendanjerwin <[email protected]>
>>>
>>> I'm trying to get Validator to work with mappings created with
>>> fluent-
>>> nhibernate. Currently the best plan I have is to have fluent-
>>> nhibernate spit out the mappings it generates and then load them
>>> each
>>> into the Validator configuration.
>>>
>>> Is there any better approach?
>>>
>>>
>>>
>>>
>>> --
>>> Fabio Maulo
>>>
>>>
>>>
>>
>>
>>
>>
>>
>>
>>
>> --
>> 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
-~----------~----~----~----~------~----~------~--~---