Example #1
0
        public static ISessionFactory GetSessionFactory(string environment)
        {
            if (!Factories.ContainsKey(environment))
            {
                Factories.Add(environment, SessionFactoryManager.GetSessionFactory(environment));
            }

            return(Factories[environment]);
        }
        public static void SetupInMemoryDatabase(HttpSessionStateBase sessionState, IDbConnection conn)
        {
            var fact = SessionFactoryManager.GetSessionFactory(GetEnvironment(sessionState));

            sessionState["sessionfactory"] = fact;

            UseSessionFactoryFromApplicationOrSessionState(sessionState);
            var session = ObjectFactory.GetInstance <ISessionFactory>().OpenSession(conn);

            SessionFactoryManager.BuildSchema(GetEnvironment(sessionState), session);
            CurrentSessionContext.Bind(session);

            UserServices.ConfigureSystemUser();
        }
        private static void SetupInMemoryDatabase(ISessionStateCache stateCache, IDbConnection conn)
        {
            var fact = SessionFactoryManager.GetSessionFactory(stateCache.GetEnvironment());

            stateCache.SetSessionFactory(fact);

            UseSessionFactoryFromApplicationOrSessionCache(stateCache);
            var session = ObjectFactory.GetInstance <ISessionFactory>().OpenSession(conn);

            SessionFactoryManager.BuildSchema(stateCache.GetEnvironment(), session);
            CurrentSessionContext.Bind(session);

            UserServices.ConfigureSystemUser();
        }
        public void BeAbleToCreateASessionFactory()
        {
            var factory = SessionFactoryManager.GetSessionFactory();

            Assert.IsNotNull(factory);
        }