Marking it virtual will help, you say? I can do that. Also you brought up another idea, an event can also help here: BuildingSessionFactory event before the session factory is built from configuration. You can then modify configuration?
Tuna Toksöz http://tunatoksoz.com Typos included to enhance the readers attention! On Thu, Jan 8, 2009 at 5:45 PM, Mike Hadlow <[email protected]> wrote: > > 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 -~----------~----~----~----~------~----~------~--~---
