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