Ejemplo n.º 1
0
        public void CanCreateNHibernateSectionFactory()
        {
            const string DEFAULT_CONNECTION_STRING = "coonStringTcc";
            var          factory = FluentSessionFactory.GetSessionFactory("thread_static", DEFAULT_CONNECTION_STRING);

            Assert.IsFalse(factory.IsClosed);
            Assert.That(factory, Is.Not.Null);
        }
Ejemplo n.º 2
0
        private static void RegisterNHibernatSectionAndFactory(ContainerBuilder builder)
        {
            builder.Register(x => FluentSessionFactory.GetSessionFactory("thread_static", "coonStringTcc"))
            .SingleInstance();

            builder.RegisterType <NHibernateInterceptor>().SingleInstance().AsSelf();

            builder.Register(x =>
            {
                var session       = x.Resolve <ISessionFactory>().OpenSession(x.Resolve <NHibernateInterceptor>());
                session.FlushMode = FlushMode.Commit;
                return(session);
            }).InstancePerHttpRequest().OnRelease(x => x.Dispose());
        }