示例#1
0
        public static void Open <TPersistenceAdapter>(string connectionString)
            where TPersistenceAdapter : IPersistenceAdapter, new()
        {
            SessionContext.SetContext(new WebSessionContext <ISession>());
            SessionFactoryContext.SetContext(new StaticContext <ISessionFactory>());
            TransactionContext.SetContext(new WebSessionContext <IDbTransaction>());

            var factory = new SessionFactoryImpl()
                          .SetAdapter(new TPersistenceAdapter())
                          .SetConnectionString(connectionString);

            SessionFactoryContext.Bind(factory);
        }
示例#2
0
 public void SessionFactoryContext_Can_Bind_Session_Instance()
 {
     SessionFactoryContext.Bind(SessionFactoryMock.Object);
     ContextMock.Verify(c => c.Bind(SessionFactoryMock.Object));
 }