BExIS.Xml.Helpers.Mapping.XmlSchemaManager.addUsageFromMetadataCompoundAttributeToMetadataCompoundAttribute C# (CSharp) Метод

addUsageFromMetadataCompoundAttributeToMetadataCompoundAttribute() приватный Метод

private addUsageFromMetadataCompoundAttributeToMetadataCompoundAttribute ( MetadataCompoundAttribute parent, MetadataCompoundAttribute compoundAttribute, XmlSchemaElement element ) : MetadataCompoundAttribute
parent BExIS.Dlm.Entities.MetadataStructure.MetadataCompoundAttribute
compoundAttribute BExIS.Dlm.Entities.MetadataStructure.MetadataCompoundAttribute
element System.Xml.Schema.XmlSchemaElement
Результат BExIS.Dlm.Entities.MetadataStructure.MetadataCompoundAttribute
        private MetadataCompoundAttribute addUsageFromMetadataCompoundAttributeToMetadataCompoundAttribute(MetadataCompoundAttribute parent, MetadataCompoundAttribute compoundAttribute, XmlSchemaElement element)
        {
            if (parent.MetadataNestedAttributeUsages.Where(p => p.Label == element.Name).Count() <= 0)
            {
                 //get max
                int max = Int32.MaxValue;
                if (element.MaxOccurs < Int32.MaxValue)
                {
                    max = Convert.ToInt32(element.MaxOccurs);
                }

                MetadataNestedAttributeUsage usage = new MetadataNestedAttributeUsage()
                {
                    Label = element.Name,
                    Description = GetDescription(element.Annotation),
                    MinCardinality = Convert.ToInt32(element.MinOccurs),
                    MaxCardinality = max,
                    Master = parent,
                    Member = compoundAttribute,

                };

                #region choice
                //if element is a choise
                XmlDocument extra = new XmlDocument();
                    //check if element is a choice
                    if (XmlSchemaUtility.IsChoiceType(element))
                    {
                        extra = XmlDatasetHelper.AddReferenceToXml(new XmlDocument(), "choice", "true", "elementType",@"extra/type");
                    }

                    if (extra.DocumentElement != null) usage.Extra = extra;
                #endregion

                parent.MetadataNestedAttributeUsages.Add(usage);

            }

            return parent;
        }