예제 #1
0
        public void InitByReadingFromDatabase(string testConfiguration, bool addInitialStockLevels)
        {
            ProductionDomainContexts productionDomainContexts = Dbms.GetDbContext();

            _productionDomainContext = productionDomainContexts.ProductionDomainContext;

            _productionDomainContextArchive =
                productionDomainContexts.ProductionDomainContextArchive;

            InitDb(testConfiguration, _productionDomainContext, true);
            InitDb(testConfiguration, _productionDomainContextArchive, false);

            _dbMasterDataCache = new DbMasterDataCache(_productionDomainContext);
            // duplicate masterData for archive
            _dbMasterDataCache.Clone(_productionDomainContextArchive);

            _dbTransactionData        = new DbTransactionData(_productionDomainContext);
            _dbTransactionDataArchive = new DbTransactionData(_productionDomainContextArchive);

            if (addInitialStockLevels)
            {
                OpenDemandManager.AddInitialStockLevels(_dbTransactionData);
            }

            _aggregator        = new Aggregator(_dbTransactionData);
            _openDemandManager = new OpenDemandManager();
        }
예제 #2
0
        public void Dispose()
        {
            _openDemandManager?.Dispose();
            _openDemandManager = null;
            _dbMasterDataCache = null;
            _testConfiguration = null;

            _productionDomainContext?.Database?.CloseConnection();
            _dbTransactionData?.Dispose();

            _productionDomainContextArchive?.Database?.CloseConnection();
            _dbTransactionDataArchive?.Dispose();

            _productionDomainContext        = null;
            _productionDomainContextArchive = null;

            _dbTransactionData        = null;
            _dbTransactionDataArchive = null;
        }