I'm trying to use Fluent NHibernate with the NHibernate Integration
Facility. FNH needs to get access to the NH config. I've used a custom
IConfigurationBuilder and registered it with the facitlity:
<facility id="nhibernate"
isWeb="false"
type="Castle.Facilities.NHibernateIntegration.NHibernateFacility,
Castle.Facilities.NHibernateIntegration"
configurationBuilder="WindsorNHibernate.Services.FluentNHibernateConfigurationBuilder,
WindsorNHibernate">
My custom configuration builder looks like this:
public class FluentNHibernateConfigurationBuilder :
DefaultConfigurationBuilder
{
public new Configuration GetConfiguration(IConfiguration config)
{
Configuration cfg = new Configuration();
ApplyConfigurationSettings(cfg, config.Children["settings"]);
RegisterAssemblies(cfg, config.Children["assemblies"]);
RegisterResources(cfg, config.Children["resources"]);
RegisterListeners(cfg, config.Children["listeners"]);
// Fluent NH call
cfg.AddMappingsFromAssembly(Assembly.GetExecutingAssembly());
return cfg;
}
}
As you see, I have to hide the GetConfiguration() method in the
DefaultConfigurationBuilder and replicate it with the addition of the
FNH call, which is kinda ugly. It would be really nice if the
DefaultConfigurationBuilder had an extension point to add any extra
configuration. Something like a virtual method I can override would be
nice.
I can submit a patch if that would be useful.
I would also like to hear if there are better ways of doing this.
Thanks
Mike
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Development List" 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/castle-project-devel?hl=en
-~----------~----~----~----~------~----~------~--~---