예제 #1
0
        public DbTransactionData(ProductionDomainContext productionDomainContext)
        {
            _productionDomainContext = productionDomainContext;

            // cache tables
            // TODO: This line should be removed
            _articles = _productionDomainContext.Articles.Include(m => m.ArticleBoms)
                        .ThenInclude(m => m.ArticleChild).Include(m => m.ArticleBoms)
                        .ThenInclude(x => x.Operation).ThenInclude(x => x.ResourceCapability)
                        .ThenInclude(s => s.ResourceCapabilityProvider).ThenInclude(r => r.ResourceSetups)
                        .ThenInclude(x => x.Resource)
                        .Include(x => x.ArticleToBusinessPartners).ThenInclude(x => x.BusinessPartner)
                        .ToList();

            _productionOrderBoms =
                new ProductionOrderBoms(_productionDomainContext.ProductionOrderBoms.ToList());

            _stockExchangeDemands =
                new StockExchangeDemands(_productionDomainContext.StockExchanges.ToList());
            _stockExchangeProviders =
                new StockExchangeProviders(_productionDomainContext.StockExchanges.ToList());

            _productionOrders =
                new ProductionOrders(_productionDomainContext.ProductionOrders.ToList());
            _purchaseOrderParts =
                new PurchaseOrderParts(_productionDomainContext.PurchaseOrderParts.ToList());

            _customerOrderParts =
                new CustomerOrderParts(_productionDomainContext.CustomerOrderParts.ToList());
            _customerOrders = new CustomerOrders(_productionDomainContext.CustomerOrders.ToList());

            // others
            _purchaseOrders.PushAll(_productionDomainContext.PurchaseOrders.ToList());
            _productionOrderOperations = new ProductionOrderOperations(
                _productionDomainContext.ProductionOrderOperations.ToList());

            // demandToProvider

            _demandToProviderTable =
                new LinkDemandAndProviderTable(_productionDomainContext.DemandToProviders);
            _providerToDemandTable =
                new LinkDemandAndProviderTable(_productionDomainContext.ProviderToDemand);
        }
 public virtual void AddAll(IEnumerable <T> items)
 {
     StackSet.PushAll(items);
 }