Esempio n. 1
0
        /// <summary>
        /// Get new production line node. Creates new node if new production line doesn't exist.
        /// </summary>
        public ContosoTopologyNode GetOrAddNewProductionLine()
        {
            ContosoTopologyNode newFactory        = GetOrAddNewFactory();
            List <string>       newProductionLine = GetAllChildren(newFactory.Key, typeof(ProductionLine), _newProductionLineName);

            if (newProductionLine.Count > 0)
            {
                // use existing new production line
                return((ContosoTopologyNode)TopologyTable[newProductionLine[0]]);
            }
            // Add new production Line to existing factory
            ProductionLineDescription productionLineDescription = new ProductionLineDescription();

            productionLineDescription.Name        = _newProductionLineName;
            productionLineDescription.Description = _newProductionLineName;
            productionLineDescription.Guid        = Guid.NewGuid().ToString();
            ProductionLine productionLine = new ProductionLine(productionLineDescription);

            productionLine.Location = newFactory.Location;
            AddChild(newFactory.Key, productionLine);
            return(productionLine);
        }