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); } }
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)); } }
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); } } }
internal override void CreateAttributeProperty(ClrBasePropertyInfo propertyInfo, List<ClrAnnotation> annotations) { propertyBuilder = TypePropertyBuilder.Create(decl, declItemsInfo); propertyBuilder.GenerateCode(propertyInfo, annotations); }
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))); } }
internal virtual void CreateProperty(ClrBasePropertyInfo propertyInfo, List<ClrAnnotation> annotations) { throw new InvalidOperationException(); }
internal static void ApplyAnnotations(CodeMemberProperty propDecl, ClrBasePropertyInfo propInfo, List<ClrAnnotation> typeAnnotations) { ApplyAnnotations(propDecl, propInfo.Annotations, typeAnnotations); }
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); } }
public virtual void GenerateConstructorCode(ClrBasePropertyInfo property) { //Do nothing for sequences and all }
public virtual void GenerateConstructorCode(ClrBasePropertyInfo property) { }
internal override void CreateProperty(ClrBasePropertyInfo propertyInfo, List<ClrAnnotation> annotations) { propertyInfo.AddToType(this.decl, annotations); }
internal override void CreateAttributeProperty(ClrBasePropertyInfo propertyInfo, List <ClrAnnotation> annotations) { this.propertyBuilder = TypePropertyBuilder.Create(this.decl, this.declItemsInfo); this.propertyBuilder.GenerateCode(propertyInfo, annotations); }
internal static void ApplyAnnotations(CodeMemberProperty propDecl, ClrBasePropertyInfo propInfo, List <ClrAnnotation> typeAnnotations) { TypeBuilder.ApplyAnnotations(propDecl, propInfo.Annotations, typeAnnotations); }
internal virtual void CreateProperty(ClrBasePropertyInfo propertyInfo, List <ClrAnnotation> annotations) { throw new InvalidOperationException(); }
private void BuildAnnotationInformation(ClrBasePropertyInfo propertyInfo, XmlSchemaObject schemaObject, bool isInChoice, bool isInNestedGroup) { AppendXsdDocumentationInformation(propertyInfo.Annotations, schemaObject); AppendCardinalityInformation(propertyInfo.Annotations, propertyInfo, schemaObject, isInChoice, isInNestedGroup); }
internal override void CreateProperty(ClrBasePropertyInfo propertyInfo, List <ClrAnnotation> annotations) { propertyInfo.AddToType(this.decl, annotations); }
internal override void CreateProperty(ClrBasePropertyInfo propertyInfo, List<ClrAnnotation> annotations) { ((ClrWrappingPropertyInfo)propertyInfo).WrappedFieldName = this.memberName; propertyInfo.AddToType(decl, annotations); }
public virtual void GenerateCode(ClrBasePropertyInfo property, List<ClrAnnotation> annotations) { property.AddToType(decl, annotations); }
public virtual void GenerateCode( ClrBasePropertyInfo property, List <ClrAnnotation> annotations) { property.AddToType(decl, annotations); }
internal override void CreateProperty(ClrBasePropertyInfo propertyInfo, List <ClrAnnotation> annotations) { ((ClrWrappingPropertyInfo)propertyInfo).WrappedFieldName = this.memberName; propertyInfo.AddToType(this.decl, annotations); }
public override void GenerateCode(ClrBasePropertyInfo property, List<ClrAnnotation> annotations) { GenerateConstructorCode(property); property.AddToType(decl, annotations); if (!declItems.hasElementWildCards) property.AddToContentModel(contentModelExpression); }
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); } }