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); } } }
public ConfigElementNode(ConfigElementNode parent, string elementType, dynamic elementMetadata) { ElementType = elementType; ElementMetadata = elementMetadata; Key = this; Parent = parent; Nodes = new List <ConfigElementNode>(); }
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); } } }