views:

203

answers:

1

I have Fluent NHiberate with the Castle Facility up and running.

However, how do you set the NamingStrategy? I tried with the Configuration object, with no luck. Does my naming strategy need to be registered in my Windsor container?

+1  A: 

As far as I can tell, there is no way to configure a naming strategy in the NHibernate facility. Please create a new issue about this.

As a workaround, you can inherit from the DefaultConfigurationBuilder and override GetConfiguration() where you would apply your NamingStrategy.

To use this new IConfigurationBuilder you just created, inject it to the NHibernateFacility when creating it:

container.AddFacility(new NHibernateFacility(new MyNamingStrategyConfigurationBuilder()));

Of course, the best solution would be that you implement this in the DefaultConfigurationBuilder and submit a patch ;-)

Mauricio Scheffer
What about Configuration.SetNamingStrategy(...)?
Daniel A. White
Of course, Configuration.SetNamingStrategy() is what you have to call inside the overriden GetConfiguration(). AFAIK SetNamingStrategy() has to be called before any mappings are registered, so it has to be there.
Mauricio Scheffer