コード例 #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);
     }
 }
コード例 #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));
     }
 }
コード例 #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);

            }
        }
コード例 #4
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 = 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);
            }
        }
コード例 #5
0
 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);
         }
     }
 }
コード例 #6
0
ファイル: TypeBuilder.cs プロジェクト: pusp/o2platform
 internal override void CreateAttributeProperty(ClrBasePropertyInfo propertyInfo, List<ClrAnnotation> annotations) {
     propertyBuilder = TypePropertyBuilder.Create(decl, declItemsInfo);
     propertyBuilder.GenerateCode(propertyInfo, annotations);
 }
コード例 #7
0
ファイル: TypeBuilder.cs プロジェクト: pusp/o2platform
        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))); 
            }

        }
コード例 #8
0
ファイル: TypeBuilder.cs プロジェクト: pusp/o2platform
 internal virtual void CreateProperty(ClrBasePropertyInfo propertyInfo, List<ClrAnnotation> annotations) {
     throw new InvalidOperationException();
 }
コード例 #9
0
ファイル: TypeBuilder.cs プロジェクト: pusp/o2platform
 internal static void ApplyAnnotations(CodeMemberProperty propDecl, ClrBasePropertyInfo propInfo, List<ClrAnnotation> typeAnnotations)
 {
     ApplyAnnotations(propDecl, propInfo.Annotations, typeAnnotations);            
 }
コード例 #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);
            }
        }
コード例 #11
0
ファイル: PropertyBuilder.cs プロジェクト: omatrot/LinqToEdmx
 public virtual void GenerateConstructorCode(ClrBasePropertyInfo property)
 {
     //Do nothing for sequences and all
 }
コード例 #12
0
 public virtual void GenerateConstructorCode(ClrBasePropertyInfo property)
 {
 }
コード例 #13
0
ファイル: TypeBuilder.cs プロジェクト: pusp/o2platform
 internal override void CreateProperty(ClrBasePropertyInfo propertyInfo, List<ClrAnnotation> annotations) {
     propertyInfo.AddToType(this.decl, annotations);
 }
コード例 #14
0
 internal override void CreateAttributeProperty(ClrBasePropertyInfo propertyInfo, List <ClrAnnotation> annotations)
 {
     this.propertyBuilder = TypePropertyBuilder.Create(this.decl, this.declItemsInfo);
     this.propertyBuilder.GenerateCode(propertyInfo, annotations);
 }
コード例 #15
0
 internal static void ApplyAnnotations(CodeMemberProperty propDecl, ClrBasePropertyInfo propInfo, List <ClrAnnotation> typeAnnotations)
 {
     TypeBuilder.ApplyAnnotations(propDecl, propInfo.Annotations, typeAnnotations);
 }
コード例 #16
0
 internal virtual void CreateProperty(ClrBasePropertyInfo propertyInfo, List <ClrAnnotation> annotations)
 {
     throw new InvalidOperationException();
 }
コード例 #17
0
 private void BuildAnnotationInformation(ClrBasePropertyInfo propertyInfo, XmlSchemaObject schemaObject, bool isInChoice, bool isInNestedGroup)
 {
     AppendXsdDocumentationInformation(propertyInfo.Annotations, schemaObject);
     AppendCardinalityInformation(propertyInfo.Annotations, propertyInfo, schemaObject, isInChoice, isInNestedGroup);
 }
コード例 #18
0
 internal override void CreateProperty(ClrBasePropertyInfo propertyInfo, List <ClrAnnotation> annotations)
 {
     propertyInfo.AddToType(this.decl, annotations);
 }
コード例 #19
0
ファイル: TypeBuilder.cs プロジェクト: pusp/o2platform
 internal override void CreateProperty(ClrBasePropertyInfo propertyInfo, List<ClrAnnotation> annotations) {
     ((ClrWrappingPropertyInfo)propertyInfo).WrappedFieldName = this.memberName;
     propertyInfo.AddToType(decl, annotations);
 }
コード例 #20
0
ファイル: PropertyBuilder.cs プロジェクト: pusp/o2platform
 public virtual void GenerateCode(ClrBasePropertyInfo property, List<ClrAnnotation> annotations) {
     property.AddToType(decl, annotations); 
 }
コード例 #21
0
ファイル: PropertyBuilder.cs プロジェクト: omatrot/LinqToEdmx
 public virtual void GenerateCode(
     ClrBasePropertyInfo property, List <ClrAnnotation> annotations)
 {
     property.AddToType(decl, annotations);
 }
コード例 #22
0
ファイル: PropertyBuilder.cs プロジェクト: pusp/o2platform
 public virtual void GenerateConstructorCode(ClrBasePropertyInfo property) {
     //Do nothing for sequences and all
 }
コード例 #23
0
 internal override void CreateProperty(ClrBasePropertyInfo propertyInfo, List <ClrAnnotation> annotations)
 {
     ((ClrWrappingPropertyInfo)propertyInfo).WrappedFieldName = this.memberName;
     propertyInfo.AddToType(this.decl, annotations);
 }
コード例 #24
0
ファイル: PropertyBuilder.cs プロジェクト: pusp/o2platform
        public override void GenerateCode(ClrBasePropertyInfo property, List<ClrAnnotation> annotations) {

            GenerateConstructorCode(property);
            property.AddToType(decl, annotations); 
            if (!declItems.hasElementWildCards) property.AddToContentModel(contentModelExpression);
        }
コード例 #25
0
 private void BuildAnnotationInformation(ClrBasePropertyInfo propertyInfo, XmlSchemaObject schemaObject, bool isInChoice, bool isInNestedGroup)
 {
     AppendXsdDocumentationInformation(propertyInfo.Annotations, schemaObject);
     AppendCardinalityInformation(propertyInfo.Annotations, propertyInfo, schemaObject, isInChoice, isInNestedGroup);
 }
コード例 #26
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);
            }
        }