Ejemplo n.º 1
0
 private void TraverseAttributes(XmlSchemaObjectTable derivedAttributes, ClrContentTypeInfo typeInfo)
 {
     foreach (XmlSchemaAttribute derivedAttribute in derivedAttributes.Values)
     {
         Debug.Assert(derivedAttribute.AttributeSchemaType !=
                      null); //For use=prohibited, without derivation it doesnt mean anything, hence attribute should be compiled
         ClrBasePropertyInfo propertyInfo = BuildProperty(derivedAttribute, false, false);
         BuildAnnotationInformation(propertyInfo, derivedAttribute, false, false);
         typeInfo.AddMember(propertyInfo);
     }
 }
Ejemplo n.º 2
0
 internal override void CreateProperty(ClrBasePropertyInfo propertyInfo, List <ClrAnnotation> annotations)
 {
     if ((!this.clrTypeInfo.InlineBaseType ? false : propertyInfo.FromBaseType))
     {
         propertyInfo.IsNew = true;
     }
     this.propertyBuilder.GenerateCode(propertyInfo, annotations);
     if ((propertyInfo.ContentType != ContentType.Property ? false : !propertyInfo.IsDuplicate))
     {
         CodeStatementCollection codeStatementCollection = this.propertyDictionaryAddStatements;
         CodeExpression[]        codeExpressionArray     = new CodeExpression[] { CodeDomHelper.XNameGetExpression(propertyInfo.SchemaName, propertyInfo.PropertyNs), CodeDomHelper.Typeof(propertyInfo.ClrTypeName) };
         codeStatementCollection.Add(CodeDomHelper.CreateMethodCallFromField("localElementDictionary", "Add", codeExpressionArray));
     }
 }
Ejemplo n.º 3
0
        public override void GenerateConstructorCode(ClrBasePropertyInfo property)
        {
            if (flatChoice && !hasDuplicateType && property.ContentType != ContentType.WildCardProperty) {
                ClrBasePropertyInfo prevProperty = null;
                string propertyReturnType = property.ClrTypeName;
                if (propertyTypeNameTable.TryGetValue(propertyReturnType, out prevProperty)) {
                    hasDuplicateType = true;
                    return;
                }
                else {
                    propertyTypeNameTable.Add(propertyReturnType, property);
                }
                if (choiceConstructors == null) {
                    choiceConstructors = new List<CodeConstructor>();
                }

                CodeConstructor choiceConstructor = CodeDomHelper.CreateConstructor(MemberAttributes.Public);
                property.AddToConstructor(choiceConstructor);
                choiceConstructors.Add(choiceConstructor);

            }
        }
        private void AppendCardinalityInformation(List <ClrAnnotation> annotations, ClrBasePropertyInfo basePropertyInfo, XmlSchemaObject schemaObject, bool isInChoice, bool isInNestedGroup)
        {
            ClrPropertyInfo propertyInfo = basePropertyInfo as ClrPropertyInfo;
            string          text         = string.Empty;

            text = string.Concat(text, "Occurrence: ");
            text = (!propertyInfo.IsOptional ? string.Concat(text, "required") : string.Concat(text, "optional"));
            if ((propertyInfo.IsStar ? true : propertyInfo.IsPlus))
            {
                text = string.Concat(text, ", repeating");
            }
            if (isInChoice)
            {
                text = string.Concat(text, ", choice");
            }
            this.AppendMessage(annotations, "summary", text);
            if (isInNestedGroup)
            {
                this.AppendMessage(annotations, "summary", "Setter: Appends");
            }
            if (propertyInfo.IsSubstitutionHead)
            {
                bool fComma = false;
                text = "Substitution members: ";
                foreach (XmlSchemaElement xse in propertyInfo.SubstitutionMembers)
                {
                    if (fComma)
                    {
                        text = string.Concat(text, ", ");
                    }
                    else
                    {
                        fComma = true;
                    }
                    text = string.Concat(text, xse.Name);
                }
                this.AppendMessage(annotations, "summary", text);
            }
        }
 public override void GenerateConstructorCode(ClrBasePropertyInfo property)
 {
     if (this.flatChoice && !this.hasDuplicateType && property.ContentType != ContentType.WildCardProperty)
     {
         ClrBasePropertyInfo prevProperty = null;
         string propertyReturnType        = property.ClrTypeName;
         if (this.propertyTypeNameTable.TryGetValue(propertyReturnType, out prevProperty))
         {
             this.hasDuplicateType = true;
         }
         else
         {
             this.propertyTypeNameTable.Add(propertyReturnType, property);
             if (this.choiceConstructors == null)
             {
                 this.choiceConstructors = new List <CodeConstructor>();
             }
             CodeConstructor choiceConstructor = CodeDomHelper.CreateConstructor(MemberAttributes.Public);
             property.AddToConstructor(choiceConstructor);
             this.choiceConstructors.Add(choiceConstructor);
         }
     }
 }
Ejemplo n.º 6
0
 internal override void CreateAttributeProperty(ClrBasePropertyInfo propertyInfo, List<ClrAnnotation> annotations) {
     propertyBuilder = TypePropertyBuilder.Create(decl, declItemsInfo);
     propertyBuilder.GenerateCode(propertyInfo, annotations);
 }
Ejemplo n.º 7
0
        internal override void CreateProperty(ClrBasePropertyInfo propertyInfo, List<ClrAnnotation> annotations) {
            if (clrTypeInfo.InlineBaseType && propertyInfo.FromBaseType) {
                propertyInfo.IsNew = true;
            }
            propertyBuilder.GenerateCode(propertyInfo, annotations);
            if ((propertyInfo.ContentType == ContentType.Property) && !propertyInfo.IsDuplicate) { //Do not add repeating properties to the LocalElementDictionary of type
                propertyDictionaryAddStatements.Add(CodeDomHelper.CreateMethodCallFromField(Constants.LocalElementDictionaryField, "Add", CodeDomHelper.XNameGetExpression(propertyInfo.SchemaName, propertyInfo.PropertyNs), CodeDomHelper.Typeof(propertyInfo.ClrTypeName))); 
            }

        }
Ejemplo n.º 8
0
 internal virtual void CreateProperty(ClrBasePropertyInfo propertyInfo, List<ClrAnnotation> annotations) {
     throw new InvalidOperationException();
 }
Ejemplo n.º 9
0
 internal static void ApplyAnnotations(CodeMemberProperty propDecl, ClrBasePropertyInfo propInfo, List<ClrAnnotation> typeAnnotations)
 {
     ApplyAnnotations(propDecl, propInfo.Annotations, typeAnnotations);            
 }
Ejemplo n.º 10
0
        private void AppendCardinalityInformation(List<ClrAnnotation> annotations,
            ClrBasePropertyInfo basePropertyInfo,
            XmlSchemaObject schemaObject,
            bool isInChoice,
            bool isInNestedGroup)
        {
            ClrPropertyInfo propertyInfo = basePropertyInfo as ClrPropertyInfo;

            string text = String.Empty;

            text += "Occurrence: ";

            if (propertyInfo.IsOptional)
            {
                text += "optional";
            }
            else
            {
                text += "required";
            }

            if (propertyInfo.IsStar ||
                propertyInfo.IsPlus)
            {
                text += ", repeating";
            }

            if (isInChoice)
            {
                text += ", choice";
            }

            // Append the occurrence message
            AppendMessage(annotations, "summary", text);

            if (isInNestedGroup)
            {
                AppendMessage(annotations, "summary", "Setter: Appends");
            }

            if (propertyInfo.IsSubstitutionHead)
            {
                bool fComma = false;
                text = "Substitution members: ";
                foreach (XmlSchemaElement xse in propertyInfo.SubstitutionMembers)
                {
                    if (!fComma)
                    {
                        fComma = true;
                    }
                    else
                    {
                        text += ", ";
                    }

                    text += xse.Name;
                }

                AppendMessage(annotations, "summary", text);
            }
        }
Ejemplo n.º 11
0
 public virtual void GenerateConstructorCode(ClrBasePropertyInfo property)
 {
     //Do nothing for sequences and all
 }
Ejemplo n.º 12
0
 public virtual void GenerateConstructorCode(ClrBasePropertyInfo property)
 {
 }
Ejemplo n.º 13
0
 internal override void CreateProperty(ClrBasePropertyInfo propertyInfo, List<ClrAnnotation> annotations) {
     propertyInfo.AddToType(this.decl, annotations);
 }
Ejemplo n.º 14
0
 internal override void CreateAttributeProperty(ClrBasePropertyInfo propertyInfo, List <ClrAnnotation> annotations)
 {
     this.propertyBuilder = TypePropertyBuilder.Create(this.decl, this.declItemsInfo);
     this.propertyBuilder.GenerateCode(propertyInfo, annotations);
 }
Ejemplo n.º 15
0
 internal static void ApplyAnnotations(CodeMemberProperty propDecl, ClrBasePropertyInfo propInfo, List <ClrAnnotation> typeAnnotations)
 {
     TypeBuilder.ApplyAnnotations(propDecl, propInfo.Annotations, typeAnnotations);
 }
Ejemplo n.º 16
0
 internal virtual void CreateProperty(ClrBasePropertyInfo propertyInfo, List <ClrAnnotation> annotations)
 {
     throw new InvalidOperationException();
 }
Ejemplo n.º 17
0
 private void BuildAnnotationInformation(ClrBasePropertyInfo propertyInfo, XmlSchemaObject schemaObject, bool isInChoice, bool isInNestedGroup)
 {
     AppendXsdDocumentationInformation(propertyInfo.Annotations, schemaObject);
     AppendCardinalityInformation(propertyInfo.Annotations, propertyInfo, schemaObject, isInChoice, isInNestedGroup);
 }
Ejemplo n.º 18
0
 internal override void CreateProperty(ClrBasePropertyInfo propertyInfo, List <ClrAnnotation> annotations)
 {
     propertyInfo.AddToType(this.decl, annotations);
 }
Ejemplo n.º 19
0
 internal override void CreateProperty(ClrBasePropertyInfo propertyInfo, List<ClrAnnotation> annotations) {
     ((ClrWrappingPropertyInfo)propertyInfo).WrappedFieldName = this.memberName;
     propertyInfo.AddToType(decl, annotations);
 }
Ejemplo n.º 20
0
 public virtual void GenerateCode(ClrBasePropertyInfo property, List<ClrAnnotation> annotations) {
     property.AddToType(decl, annotations); 
 }
Ejemplo n.º 21
0
 public virtual void GenerateCode(
     ClrBasePropertyInfo property, List <ClrAnnotation> annotations)
 {
     property.AddToType(decl, annotations);
 }
Ejemplo n.º 22
0
 public virtual void GenerateConstructorCode(ClrBasePropertyInfo property) {
     //Do nothing for sequences and all
 }
 internal override void CreateProperty(ClrBasePropertyInfo propertyInfo, List <ClrAnnotation> annotations)
 {
     ((ClrWrappingPropertyInfo)propertyInfo).WrappedFieldName = this.memberName;
     propertyInfo.AddToType(this.decl, annotations);
 }
Ejemplo n.º 24
0
        public override void GenerateCode(ClrBasePropertyInfo property, List<ClrAnnotation> annotations) {

            GenerateConstructorCode(property);
            property.AddToType(decl, annotations); 
            if (!declItems.hasElementWildCards) property.AddToContentModel(contentModelExpression);
        }
Ejemplo n.º 25
0
 private void BuildAnnotationInformation(ClrBasePropertyInfo propertyInfo, XmlSchemaObject schemaObject, bool isInChoice, bool isInNestedGroup)
 {
     AppendXsdDocumentationInformation(propertyInfo.Annotations, schemaObject);
     AppendCardinalityInformation(propertyInfo.Annotations, propertyInfo, schemaObject, isInChoice, isInNestedGroup);
 }
        private void AppendCardinalityInformation(List <ClrAnnotation> annotations,
                                                  ClrBasePropertyInfo basePropertyInfo,
                                                  XmlSchemaObject schemaObject,
                                                  bool isInChoice,
                                                  bool isInNestedGroup)
        {
            ClrPropertyInfo propertyInfo = basePropertyInfo as ClrPropertyInfo;

            string text = String.Empty;

            text += "Occurrence: ";

            if (propertyInfo.IsOptional)
            {
                text += "optional";
            }
            else
            {
                text += "required";
            }


            if (propertyInfo.IsStar ||
                propertyInfo.IsPlus)
            {
                text += ", repeating";
            }

            if (isInChoice)
            {
                text += ", choice";
            }

            // Append the occurrence message
            AppendMessage(annotations, "summary", text);

            if (isInNestedGroup)
            {
                AppendMessage(annotations, "summary", "Setter: Appends");
            }

            if (propertyInfo.IsSubstitutionHead)
            {
                bool fComma = false;
                text = "Substitution members: ";
                foreach (XmlSchemaElement xse in propertyInfo.SubstitutionMembers)
                {
                    if (!fComma)
                    {
                        fComma = true;
                    }
                    else
                    {
                        text += ", ";
                    }

                    text += xse.Name;
                }

                AppendMessage(annotations, "summary", text);
            }
        }