コード例 #1
0
        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);
        }
コード例 #2
0
        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>());
        }
コード例 #3
0
        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>());
        }
コード例 #4
0
        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();
        }
コード例 #5
0
            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;
            }