/// <summary> /// Configures the NHibernate session. /// </summary> /// <param name="configurationProvider">The configuration provider.</param> /// <param name="container">The container.</param> protected override void ConfigureNHibernateSession(IConfigurationProvider configurationProvider, IContainer container) { var configuration = configurationProvider.Configure().GetEnumerator().Current; configuration.SetProperty(Environment.CurrentSessionContextClass, typeof(WebSessionContext).AssemblyQualifiedName); var sessionFactoryProvider = new SessionFactoryProvider(configurationProvider); sessionFactoryProvider.Initialize(); container.Configure(x => x.For <ISessionFactoryProvider>().Singleton().Use(sessionFactoryProvider)); }
private static void InitializeAndRegisterPersistenceStuff(IContainer container) { var configurationProvider = container.GetInstance <IConfigurationProvider> (); var configuration = configurationProvider.Configure().GetEnumerator().Current; configuration.SetProperty( Environment.CurrentSessionContextClass, "uNhAddIns.SessionEasier.Contexts.ThreadLocalSessionContext, uNhAddIns"); var sessionFactoryProvider = new SessionFactoryProvider(configurationProvider); sessionFactoryProvider.Initialize(); container.Configure(x => x.For <ISessionFactoryProvider> ().Singleton().Use(sessionFactoryProvider)); container.Configure(x => x.For <ISessionProvider> ().Use <SessionProvider> ()); }