Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
 public void Initialize()
 {
     SessionFactoryMock = new Mock <ISessionFactory>();
     ContextMock        = new Mock <IContext <ISessionFactory> >();
     SessionFactoryContext.SetContext(ContextMock.Object);
 }