private async Task <List <AFAttributeDTO> > GetAllAttributeDTOsAsync(AFAttributeDTO attributeDTO)
        {
            List <AFAttributeDTO> selfAndChildren = new List <AFAttributeDTO>()
            {
                attributeDTO
            };

            if (attributeDTO.HasChildren)
            {
                List <AFAttributeDTO> children = await GetImmediateChildAttributeDTOsAsync(attributeDTO.WebId);

                foreach (AFAttributeDTO child in children)
                {
                    List <AFAttributeDTO> childAndAllDescendants = await GetAllAttributeDTOsAsync(child);

                    selfAndChildren.AddRange(childAndAllDescendants);
                }
            }
            return(selfAndChildren);
        }
Exemple #2
0
        /// <summary>
        /// Slims an AF SDK AFAttributeTemplate
        /// </summary>
        /// <param name="attributeTemplate">The template to be slimmed</param>
        /// <param name="attributeInstance">Optional attribute instance to provide data reference information if not set on the template</param>
        /// <returns></returns>
        public static AFAttributeTemplateSlim ToSlim(this AFAttributeTemplateDTO attributeTemplate, AFAttributeDTO attributeInstance = null)
        {
            string pathRelativeToElement = attributeTemplate.GetPathRelativeToElement();

            AFAttributeTemplateSlim slim = new AFAttributeTemplateSlim()
            {
                Id            = attributeTemplate.Id,
                FullName      = pathRelativeToElement,
                Name          = attributeTemplate.Name,
                Description   = attributeTemplate.Description,
                IsTopLevel    = !pathRelativeToElement.Contains('|'),
                TypeName      = attributeTemplate.Type,
                TypeQualifier = attributeTemplate.TypeQualifier,
                IsHidden      = attributeTemplate.IsHidden,
                IsStatic      = string.IsNullOrWhiteSpace(attributeTemplate.DataReferencePlugIn) && string.IsNullOrWhiteSpace(attributeInstance.DataReferencePlugIn),
                HasChildren   = attributeTemplate.HasChildren,
                CategoryNames = attributeTemplate.CategoryNames
            };

            return(slim);
        }