コード例 #1
0
        public void BuildElement(ICollection <ConfigElementNode> elements, ConfigElementNode elementParent,
                                 dynamic elementMetadata, string elementType)
        {
            if (!ReferenceEquals(elementMetadata, null))
            {
                IConfigElementNodeFactory factory;

                if (_factories.TryGetValue(elementType, out factory))
                {
                    var element = new ConfigElementNode(elementParent, elementType, elementMetadata);

                    if (elementParent != null)
                    {
                        element.ConfigId   = elementParent.ConfigId;
                        element.DocumentId = elementParent.DocumentId;
                        element.Version    = elementParent.Version;
                    }

                    elements.Add(element);

                    if (elementParent != null)
                    {
                        elementParent.Nodes.Add(element);
                    }

                    factory.Create(this, elements, element);
                }
            }
        }
コード例 #2
0
        public ConfigElementNode(ConfigElementNode parent, string elementType, dynamic elementMetadata)
        {
            ElementType     = elementType;
            ElementMetadata = elementMetadata;

            Key    = this;
            Parent = parent;
            Nodes  = new List <ConfigElementNode>();
        }
コード例 #3
0
 public void BuildElements(ICollection <ConfigElementNode> elements, ConfigElementNode elementParent,
                           IEnumerable elementMetadata, string elementType)
 {
     if (!ReferenceEquals(elementMetadata, null))
     {
         foreach (var itemMetadata in elementMetadata)
         {
             BuildElement(elements, elementParent, itemMetadata, elementType);
         }
     }
 }