public SQLiteUnitOfWorkFactory( INHibernatePersistenceConfiguration configuration, ISessionFactory sessionFactory, IInterceptUnitOfWork[] interceptors, IAuditConfiguration auditConfiguration, IDateTime dateTime, IUserContext userContext, ILogger logger) { ThrowIf.ArgumentIsNull(configuration, "configuration"); ThrowIf.ArgumentIsNull(sessionFactory, "sessionFactory"); ThrowIf.ArgumentIsNull(logger, "logger"); this.sessionFactory = sessionFactory; this.interceptors = interceptors; this.auditConfiguration = auditConfiguration; this.dateTime = dateTime; this.userContext = userContext; this.logger = logger; // Create an in-memory database connection for the factory. This will be (re)used for each // new instance of NHibernateUnitOfWork. this.connection = new SQLiteConnection(SQLiteDatabaseConfigurer.InMemoryConnectionString); this.connection.Open(); // Create the schema in the connection based on the NHibernate mappings configuration.CreateSchema(this.connection); }
public void SetupBeforeEachTest() { this.automappingConfiguration = new SQLiteAtlasAutoMappingConfiguration(); this.fluentMapperConfigurer = new FluentAutoMapperConfigurer(); this.fluentMapperConfigurer.AutoMappingConfiguration(this.automappingConfiguration); this.configuration = new NHibernateConfiguration(new ConsoleLogger()); this.configuration.RegisterConfigurer(new SQLiteDatabaseConfigurer()); this.configuration.RegisterConfigurer(this.fluentMapperConfigurer); this.configuration.RegisterConfigurer(new ProxyConfigurer <CastleProxyFactoryFactory>()); }
public void SetupBeforeEachTest() { this.fluentMapperConfigurer = new FluentMapperConfigurer() .RegisterConvention <SQLiteXElementConvention>() .RegisterEntitiesFromAssemblyOf <ConventionTests>(); this.configuration = new NHibernateConfiguration(new ConsoleLogger()); this.configuration.RegisterConfigurer(new SQLiteDatabaseConfigurer()); this.configuration.RegisterConfigurer(this.fluentMapperConfigurer); this.configuration.RegisterConfigurer(new ProxyConfigurer <CastleProxyFactoryFactory>()); }
public void SetupOnceBeforeAllTests() { var logger = new ConsoleLogger(); var databaseConfigurer = new SQLiteDatabaseConfigurer(); var mapperConfigurer = new FluentMapperConfigurer() .RegisterConvention <SQLiteXElementConvention>() .RegisterEntitiesFromAssembly(Assembly.GetExecutingAssembly()); this.configuration = new NHibernateConfiguration(logger); this.configuration.RegisterConfigurer(databaseConfigurer); this.configuration.RegisterConfigurer(mapperConfigurer); this.configuration.RegisterConfigurer(new ProxyConfigurer <CastleProxyFactoryFactory>()); this.sessionFactory = this.configuration.CreateSessionFactory(); }
public Factory( INHibernatePersistenceConfiguration configuration, IInterceptUnitOfWork[] interceptors, IAuditConfiguration auditConfiguration, IDateTime dateTime, IUserContext userContext, ILogger logger) { ThrowIf.ArgumentIsNull(configuration, "configuration"); ThrowIf.ArgumentIsNull(logger, "logger"); this.sessionFactory = configuration.CreateSessionFactory(); this.interceptors = interceptors; this.auditConfiguration = auditConfiguration; this.dateTime = dateTime; this.userContext = userContext; this.logger = logger; }