public DataItemInfo(DataItemDefinition definition, List <ComponentDefinition> components) { this.Id = definition.Id; this.Type = definition.Type; this.ParentId = definition.ParentId; this.SubType = definition.SubType; this.Parents = DataItemInfo.GetParents(definition.ParentId, components); }
private static List <ComponentDefinition> GetParents(string parentId, List <ComponentDefinition> components) { List <ComponentDefinition> componentDefinitionList = new List <ComponentDefinition>(); if (!parentId.IsNullOrEmpty <char>()) { ComponentDefinition componentDefinition = components.Find((Predicate <ComponentDefinition>)(o => o.Id == parentId)); if (componentDefinition != null) { componentDefinitionList.Add(componentDefinition); componentDefinitionList.AddRange((IEnumerable <ComponentDefinition>)DataItemInfo.GetParents(componentDefinition.ParentId, components)); } } return(componentDefinitionList); }