void ExportProperty(CodeTypeDeclaration codeClass, MemberMapping member, CodeIdentifiers memberScope)
        {
            string fieldName = memberScope.AddUnique(CodeExporter.MakeFieldName(member.Name), member);
            string fieldType = member.GetTypeName(CodeProvider);
            // need to create a private field
            CodeMemberField field = new CodeMemberField(fieldType, fieldName);

            field.Attributes = MemberAttributes.Private;
            codeClass.Members.Add(field);

            CodeMemberProperty prop = CreatePropertyDeclaration(field, member.Name, fieldType);

            prop.Comments.Add(new CodeCommentStatement(Res.GetString(Res.XmlRemarks), true));
            AddMemberMetadata(prop.CustomAttributes, member, false);
            codeClass.Members.Add(prop);

            if (member.CheckSpecified != SpecifiedAccessor.None)
            {
                field            = new CodeMemberField(typeof(bool).FullName, fieldName + "Specified");
                field.Attributes = MemberAttributes.Private;
                codeClass.Members.Add(field);

                prop = CreatePropertyDeclaration(field, member.Name + "Specified", typeof(bool).FullName);
                prop.Comments.Add(new CodeCommentStatement(Res.GetString(Res.XmlRemarks), true));
                CodeAttributeDeclaration attribute = new CodeAttributeDeclaration(typeof(SoapIgnoreAttribute).FullName);
                prop.CustomAttributes.Add(attribute);
                codeClass.Members.Add(prop);
            }
        }
        private void ExportProperty(CodeTypeDeclaration codeClass, MemberMapping member, string ns, CodeIdentifiers memberScope, CodeConstructor ctor)
        {
            string          name     = memberScope.AddUnique(CodeExporter.MakeFieldName(member.Name), member);
            string          typeName = member.GetTypeName(base.CodeProvider);
            CodeMemberField field    = new CodeMemberField(typeName, name)
            {
                Attributes = MemberAttributes.Private
            };

            codeClass.Members.Add(field);
            CodeMemberProperty property = base.CreatePropertyDeclaration(field, member.Name, typeName);

            property.Comments.Add(new CodeCommentStatement(Res.GetString("XmlRemarks"), true));
            this.AddMemberMetadata(field, property.CustomAttributes, member, ns, false, property.Comments, ctor);
            codeClass.Members.Add(property);
            if (member.CheckSpecified != SpecifiedAccessor.None)
            {
                field = new CodeMemberField(typeof(bool).FullName, name + "Specified")
                {
                    Attributes = MemberAttributes.Private
                };
                codeClass.Members.Add(field);
                property = base.CreatePropertyDeclaration(field, member.Name + "Specified", typeof(bool).FullName);
                property.Comments.Add(new CodeCommentStatement(Res.GetString("XmlRemarks"), true));
                CodeAttributeDeclaration declaration = new CodeAttributeDeclaration(typeof(XmlIgnoreAttribute).FullName);
                property.CustomAttributes.Add(declaration);
                codeClass.Members.Add(property);
            }
        }
        void ExportMember(CodeTypeDeclaration codeClass, MemberMapping member)
        {
            string          fieldType = member.GetTypeName(CodeProvider);
            CodeMemberField field     = new CodeMemberField(fieldType, member.Name);

            field.Attributes = (field.Attributes & ~MemberAttributes.AccessMask) | MemberAttributes.Public;
            field.Comments.Add(new CodeCommentStatement(Res.GetString(Res.XmlRemarks), true));
            codeClass.Members.Add(field);
            AddMemberMetadata(field.CustomAttributes, member, false);

            if (member.CheckSpecified != SpecifiedAccessor.None)
            {
                field            = new CodeMemberField(typeof(bool).FullName, member.Name + "Specified");
                field.Attributes = (field.Attributes & ~MemberAttributes.AccessMask) | MemberAttributes.Public;
                field.Comments.Add(new CodeCommentStatement(Res.GetString(Res.XmlRemarks), true));
                CodeAttributeDeclaration attribute = new CodeAttributeDeclaration(typeof(SoapIgnoreAttribute).FullName);
                field.CustomAttributes.Add(attribute);
                codeClass.Members.Add(field);
            }
        }
        private void ExportMember(CodeTypeDeclaration codeClass, MemberMapping member, string ns, CodeConstructor ctor)
        {
            CodeMemberField field;

            field = new CodeMemberField(member.GetTypeName(base.CodeProvider), member.Name)
            {
                Attributes = (field.Attributes & ~MemberAttributes.AccessMask) | MemberAttributes.Public
            };
            field.Comments.Add(new CodeCommentStatement(Res.GetString("XmlRemarks"), true));
            codeClass.Members.Add(field);
            this.AddMemberMetadata(field, field.CustomAttributes, member, ns, false, field.Comments, ctor);
            if (member.CheckSpecified != SpecifiedAccessor.None)
            {
                field = new CodeMemberField(typeof(bool).FullName, member.Name + "Specified")
                {
                    Attributes = (field.Attributes & ~MemberAttributes.AccessMask) | MemberAttributes.Public
                };
                field.Comments.Add(new CodeCommentStatement(Res.GetString("XmlRemarks"), true));
                CodeAttributeDeclaration declaration = new CodeAttributeDeclaration(typeof(XmlIgnoreAttribute).FullName);
                field.CustomAttributes.Add(declaration);
                codeClass.Members.Add(field);
            }
        }
Пример #5
0
        void ExportProperty(CodeTypeDeclaration codeClass, MemberMapping member, CodeIdentifiers memberScope) {
            string fieldName = memberScope.AddUnique(CodeExporter.MakeFieldName(member.Name), member);
            string fieldType = member.GetTypeName(CodeProvider);
            // need to create a private field
            CodeMemberField field = new CodeMemberField(fieldType, fieldName);
            field.Attributes = MemberAttributes.Private;
            codeClass.Members.Add(field);

            CodeMemberProperty prop = CreatePropertyDeclaration(field, member.Name, fieldType);
            prop.Comments.Add(new CodeCommentStatement(Res.GetString(Res.XmlRemarks), true));
            AddMemberMetadata(prop.CustomAttributes, member, false);
            codeClass.Members.Add(prop);

            if (member.CheckSpecified != SpecifiedAccessor.None) {
                field = new CodeMemberField(typeof(bool).FullName, fieldName + "Specified");
                field.Attributes = MemberAttributes.Private;
                codeClass.Members.Add(field);
                
                prop = CreatePropertyDeclaration(field, member.Name + "Specified", typeof(bool).FullName);
                prop.Comments.Add(new CodeCommentStatement(Res.GetString(Res.XmlRemarks), true));
                CodeAttributeDeclaration attribute = new CodeAttributeDeclaration(typeof(SoapIgnoreAttribute).FullName);
                prop.CustomAttributes.Add(attribute);
                codeClass.Members.Add(prop);
            }
        }
Пример #6
0
        void ExportMember(CodeTypeDeclaration codeClass, MemberMapping member) {
            string fieldType = member.GetTypeName(CodeProvider);
            CodeMemberField field = new CodeMemberField(fieldType, member.Name);
            field.Attributes = (field.Attributes & ~MemberAttributes.AccessMask) | MemberAttributes.Public;
            field.Comments.Add(new CodeCommentStatement(Res.GetString(Res.XmlRemarks), true));
            codeClass.Members.Add(field);
            AddMemberMetadata(field.CustomAttributes, member, false);

            if (member.CheckSpecified != SpecifiedAccessor.None) {
                field = new CodeMemberField(typeof(bool).FullName, member.Name + "Specified");
                field.Attributes = (field.Attributes & ~MemberAttributes.AccessMask) | MemberAttributes.Public;
                field.Comments.Add(new CodeCommentStatement(Res.GetString(Res.XmlRemarks), true));
                CodeAttributeDeclaration attribute = new CodeAttributeDeclaration(typeof(SoapIgnoreAttribute).FullName);
                field.CustomAttributes.Add(attribute);
                codeClass.Members.Add(field);
            }
        }
Пример #7
0
 /// <include file='doc\XmlMemberMapping.uex' path='docs/doc[@for="XmlMemberMapping.GenerateTypeName"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public string GenerateTypeName(CodeDomProvider codeProvider)
 {
     return(mapping.GetTypeName(codeProvider));
 }
 private void ExportProperty(CodeTypeDeclaration codeClass, MemberMapping member, CodeIdentifiers memberScope)
 {
     string name = memberScope.AddUnique(CodeExporter.MakeFieldName(member.Name), member);
     string typeName = member.GetTypeName(base.CodeProvider);
     CodeMemberField field = new CodeMemberField(typeName, name) {
         Attributes = MemberAttributes.Private
     };
     codeClass.Members.Add(field);
     CodeMemberProperty property = base.CreatePropertyDeclaration(field, member.Name, typeName);
     property.Comments.Add(new CodeCommentStatement(Res.GetString("XmlRemarks"), true));
     this.AddMemberMetadata(property.CustomAttributes, member, false);
     codeClass.Members.Add(property);
     if (member.CheckSpecified != SpecifiedAccessor.None)
     {
         field = new CodeMemberField(typeof(bool).FullName, name + "Specified") {
             Attributes = MemberAttributes.Private
         };
         codeClass.Members.Add(field);
         property = base.CreatePropertyDeclaration(field, member.Name + "Specified", typeof(bool).FullName);
         property.Comments.Add(new CodeCommentStatement(Res.GetString("XmlRemarks"), true));
         CodeAttributeDeclaration declaration = new CodeAttributeDeclaration(typeof(SoapIgnoreAttribute).FullName);
         property.CustomAttributes.Add(declaration);
         codeClass.Members.Add(property);
     }
 }
 private void ExportMember(CodeTypeDeclaration codeClass, MemberMapping member, string ns, CodeConstructor ctor)
 {
     CodeMemberField field;
     field = new CodeMemberField(member.GetTypeName(base.CodeProvider), member.Name) {
         Attributes = (field.Attributes & ~MemberAttributes.AccessMask) | MemberAttributes.Public
     };
     field.Comments.Add(new CodeCommentStatement(Res.GetString("XmlRemarks"), true));
     codeClass.Members.Add(field);
     this.AddMemberMetadata(field, field.CustomAttributes, member, ns, false, field.Comments, ctor);
     if (member.CheckSpecified != SpecifiedAccessor.None)
     {
         field = new CodeMemberField(typeof(bool).FullName, member.Name + "Specified") {
             Attributes = (field.Attributes & ~MemberAttributes.AccessMask) | MemberAttributes.Public
         };
         field.Comments.Add(new CodeCommentStatement(Res.GetString("XmlRemarks"), true));
         CodeAttributeDeclaration declaration = new CodeAttributeDeclaration(typeof(XmlIgnoreAttribute).FullName);
         field.CustomAttributes.Add(declaration);
         codeClass.Members.Add(field);
     }
 }