Пример #1
0
        public DbPreTestDataWorker(ServiceContext serviceContext)
        {
            this.SqlSyntaxProvider = serviceContext.SqlSyntax;

            var uowProvider = new PetaPocoUnitOfWorkProvider(new Mock<ILogger>().Object);

            Database = uowProvider.GetUnitOfWork().Database;

            _serviceContext = serviceContext;

            WarehouseCatalog = new WarehouseCatalog(Constants.DefaultKeys.Warehouse.DefaultWarehouseKey)
            {
                Key = Constants.DefaultKeys.Warehouse.DefaultWarehouseCatalogKey
            };
        }
Пример #2
0
        public DbPreTestDataWorker(ServiceContext serviceContext)
        {
            var syntax = (DbSyntax)Enum.Parse(typeof (DbSyntax), ConfigurationManager.AppSettings["syntax"]);
            // sets up the Umbraco SqlSyntaxProvider Singleton
            SqlSyntaxProviderTestHelper.EstablishSqlSyntax(syntax);

            var uowProvider = new PetaPocoUnitOfWorkProvider();

            Database = uowProvider.GetUnitOfWork().Database;

            _serviceContext = serviceContext;

            WarehouseCatalog = new WarehouseCatalog(Constants.DefaultKeys.Warehouse.DefaultWarehouseKey)
            {
                Key = Constants.DefaultKeys.Warehouse.DefaultWarehouseCatalogKey
            };
        }
Пример #3
0
        public DbPreTestDataWorker()
        {
            var syntax = (DbSyntax)Enum.Parse(typeof(DbSyntax), ConfigurationManager.AppSettings["syntax"]);

            // sets up the Umbraco SqlSyntaxProvider Singleton OBSOLETE
            SqlSyntaxProviderTestHelper.EstablishSqlSyntax(syntax);

            this.SqlSyntaxProvider = SqlSyntaxProviderTestHelper.SqlSyntaxProvider(syntax);

            var uowProvider = new PetaPocoUnitOfWorkProvider(new Mock<ILogger>().Object);

            Database = uowProvider.GetUnitOfWork().Database;
            TestLogger = Logger.CreateWithDefaultLog4NetConfiguration();
            _serviceContext = new ServiceContext(new RepositoryFactory(), new PetaPocoUnitOfWorkProvider(TestLogger), TestLogger, new TransientMessageFactory());

            WarehouseCatalog = new WarehouseCatalog(Constants.DefaultKeys.Warehouse.DefaultWarehouseKey)
            {
                Key = Constants.DefaultKeys.Warehouse.DefaultWarehouseCatalogKey
            };
        }
Пример #4
0
        public override IBootManager Initialize()
        {
            if (_isInitialized)
                throw new InvalidOperationException("The Merchello core boot manager has already been initialized");

            OnMerchelloInit();

            _timer = DisposableTimer.DebugDuration<CoreBootManager>("Merchello starting", "Merchello startup complete");

            // create the service context for the MerchelloAppContext
            var connString = ConfigurationManager.ConnectionStrings[MerchelloConfiguration.Current.Section.DefaultConnectionStringName].ConnectionString;
            var providerName = ConfigurationManager.ConnectionStrings[MerchelloConfiguration.Current.Section.DefaultConnectionStringName].ProviderName;

            _unitOfWorkProvider = new PetaPocoUnitOfWorkProvider(connString, providerName);

            var serviceContext = new ServiceContext(_unitOfWorkProvider);

            var cache = ApplicationContext.Current == null
                            ? new CacheHelper(
                                    new ObjectCacheRuntimeCacheProvider(),
                                    new StaticCacheProvider(),
                                    new NullCacheProvider())
                            : ApplicationContext.Current.ApplicationCache;

            InitializeGatewayResolver(serviceContext, cache);

            CreateMerchelloContext(serviceContext, cache);

            InitializeResolvers();

            _isInitialized = true;

            return this;
        }
 /// <summary>
 /// Static helper method to return a new unit of work
 /// </summary>
 /// <returns></returns>
 internal static IDatabaseUnitOfWork CreateUnitOfWork()
 {
     var provider = new PetaPocoUnitOfWorkProvider();
     return provider.GetUnitOfWork();
 }
Пример #6
0
        /// <summary>
        /// Static helper method to return a new unit of work
        /// </summary>
        /// <returns></returns>
        internal static IDatabaseUnitOfWork CreateUnitOfWork(ILogger logger)
        {
            var provider = new PetaPocoUnitOfWorkProvider(logger);

            return(provider.GetUnitOfWork());
        }