public void Should_store_session_factory_in_singleton()
        {
            var builder  = new SessionFactoryBuilder();
            var factory1 = builder.GetFactory();

            factory1.ShouldNotBeNull();

            var factory2 = builder.GetFactory();

            ReferenceEquals(factory1, factory2).ShouldBeTrue();
        }
示例#2
0
        public ISessionFactory Configure <TMapping>(string profile = "")
        {
            MigrationProfile = profile;
            var factory = Builder.GetFactory(ConnectionString, GetSessionFactory <TMapping>);

            CreateSchema();
            return(factory);
        }
        public void Should_create_the_NHibernate_configuration()
        {
            var builder        = new SessionFactoryBuilder();
            var sessionFactory = builder.GetFactory();

            sessionFactory.ShouldNotBeNull();
            var metadata = sessionFactory.GetClassMetadata(typeof(User));

            metadata.EntityName.Contains(typeof(User).Name).ShouldBeTrue();
        }
        public void GetFactory_with_key_should_return_factory_by_function()
        {
            var factory = Builder.GetFactory("factory", BuildFactory);

            Assert.IsInstanceOf <ISessionFactory>(factory);
        }
示例#5
0
 public NHibernateModule(Dictionary <string, ISessionFactory> factories)
 {
     Factories            = factories;
     Factories["Default"] = Builder.GetFactory("Default", DefaultFactory);
 }