Пример #1
0
        protected override void GenerateElementInfoMember(CodeAttributeDeclarationCollection attributes, XmlTypeMapMemberElement member, XmlTypeMapElementInfo einfo, TypeData defaultType, string defaultNamespace, bool addAlwaysAttr, bool forceUseMemberName)
        {
            CodeAttributeDeclaration att = new CodeAttributeDeclaration("Mpd.Xml.Serialization.XmlElementAttribute");

            if (forceUseMemberName || einfo.ElementName != member.Name)
            {
                att.Arguments.Add(GetArg(einfo.ElementName));
            }
            if (einfo.TypeData.FullTypeName != defaultType.FullTypeName)
            {
                att.Arguments.Add(GetTypeArg("Type", einfo.TypeData.FullTypeName));
            }
            if (einfo.Namespace != defaultNamespace)
            {
                att.Arguments.Add(GetArg("Namespace", einfo.Namespace));
            }
            if (einfo.Form == XmlSchemaForm.Unqualified)
            {
                att.Arguments.Add(GetEnumArg("Form", "System.Xml.Schema.XmlSchemaForm", einfo.Form.ToString()));
            }
            if (einfo.IsNullable)
            {
                att.Arguments.Add(GetArg("IsNullable", true));
            }
            if (!TypeTranslator.IsDefaultPrimitiveTpeData(einfo.TypeData))
            {
                att.Arguments.Add(GetArg("DataType", einfo.TypeData.XmlType));
            }
            if (addAlwaysAttr || att.Arguments.Count > 0)
            {
                attributes.Add(att);
            }
        }
Пример #2
0
        protected override void GenerateAttributeMember(CodeAttributeDeclarationCollection attributes, XmlTypeMapMemberAttribute attinfo, string defaultNamespace, bool forceUseMemberName)
        {
            CodeAttributeDeclaration att = new CodeAttributeDeclaration("Mpd.Xml.Serialization.XmlAttributeAttribute");

            if (forceUseMemberName || attinfo.Name != attinfo.AttributeName)
            {
                att.Arguments.Add(GetArg(attinfo.AttributeName));
            }
            if (attinfo.Namespace != defaultNamespace)
            {
                att.Arguments.Add(GetArg("Namespace", attinfo.Namespace));
            }
            if (attinfo.Form == XmlSchemaForm.Qualified)
            {
                att.Arguments.Add(GetEnumArg("Form", "System.Xml.Schema.XmlSchemaForm", attinfo.Form.ToString()));
            }
            if (!TypeTranslator.IsDefaultPrimitiveTpeData(attinfo.TypeData))
            {
                att.Arguments.Add(GetArg("DataType", attinfo.TypeData.XmlType));
            }
            attributes.Add(att);

            if (attinfo.Ignore)
            {
                attributes.Add(new CodeAttributeDeclaration("Mpd.Xml.Serialization.XmlIgnoreAttribute"));
            }
        }
Пример #3
0
        protected override void GenerateElementInfoMember(CodeAttributeDeclarationCollection attributes, XmlTypeMapMemberElement member, XmlTypeMapElementInfo einfo, TypeData defaultType, string defaultNamespace, bool addAlwaysAttr, bool forceUseMemberName)
        {
            CodeAttributeDeclaration att = new CodeAttributeDeclaration("Mpd.Xml.Serialization.SoapElement");

            if (forceUseMemberName || einfo.ElementName != member.Name)
            {
                att.Arguments.Add(GetArg(einfo.ElementName));
            }
//			if (einfo.IsNullable) att.Arguments.Add (GetArg ("IsNullable", true));	MS seems to ignore this
            if (!TypeTranslator.IsDefaultPrimitiveTpeData(einfo.TypeData))
            {
                att.Arguments.Add(GetArg("DataType", einfo.TypeData.XmlType));
            }
            if (addAlwaysAttr || att.Arguments.Count > 0)
            {
                attributes.Add(att);
            }
        }
Пример #4
0
        protected override void GenerateAttributeMember(CodeAttributeDeclarationCollection attributes, XmlTypeMapMemberAttribute attinfo, string defaultNamespace, bool forceUseMemberName)
        {
            CodeAttributeDeclaration att = new CodeAttributeDeclaration("Mpd.Xml.Serialization.SoapAttribute");

            if (attinfo.Name != attinfo.AttributeName)
            {
                att.Arguments.Add(GetArg(attinfo.AttributeName));
            }
            if (attinfo.Namespace != defaultNamespace)
            {
                att.Arguments.Add(GetArg("Namespace", attinfo.Namespace));
            }
            if (!TypeTranslator.IsDefaultPrimitiveTpeData(attinfo.TypeData))
            {
                att.Arguments.Add(GetArg("DataType", attinfo.TypeData.XmlType));
            }
            attributes.Add(att);
        }
Пример #5
0
        public void AddMappingMetadata(CodeAttributeDeclarationCollection metadata, XmlMemberMapping member, bool forceUseMemberName)
        {
            TypeData memType = member.TypeMapMember.TypeData;

            CodeAttributeDeclaration att = new CodeAttributeDeclaration("Mpd.Xml.Serialization.SoapElement");

            if (forceUseMemberName || (member.ElementName != member.MemberName))
            {
                att.Arguments.Add(new CodeAttributeArgument(new CodePrimitiveExpression(member.ElementName)));
            }
            if (!TypeTranslator.IsDefaultPrimitiveTpeData(memType))
            {
                att.Arguments.Add(new CodeAttributeArgument("DataType", new CodePrimitiveExpression(member.TypeName)));
            }

            if (att.Arguments.Count > 0)
            {
                metadata.Add(att);
            }
        }