• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Serialization.XmlMembersMapping类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Xml.Serialization.XmlMembersMapping的典型用法代码示例。如果您正苦于以下问题:C# XmlMembersMapping类的具体用法?C# XmlMembersMapping怎么用?C# XmlMembersMapping使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XmlMembersMapping类属于System.Xml.Serialization命名空间,在下文中一共展示了XmlMembersMapping类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CreateEncodedMessage

 private void CreateEncodedMessage(Message message, MessageBinding messageBinding, XmlMembersMapping members, bool wrapped)
 {
     this.SoapExporter.ExportMembersMapping(members, wrapped);
     if (wrapped)
     {
         MessagePart messagePart = new MessagePart {
             Name = "parameters",
             Type = new XmlQualifiedName(members.TypeName, members.TypeNamespace)
         };
         message.Parts.Add(messagePart);
     }
     else
     {
         for (int i = 0; i < members.Count; i++)
         {
             XmlMemberMapping mapping = members[i];
             MessagePart part2 = new MessagePart {
                 Name = mapping.XsdElementName,
                 Type = new XmlQualifiedName(mapping.TypeName, mapping.TypeNamespace)
             };
             message.Parts.Add(part2);
         }
     }
     messageBinding.Extensions.Add(this.CreateSoapBodyBinding(SoapBindingUse.Encoded, members.Namespace));
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:SoapProtocolReflector.cs


示例2: ExportMembersMapping

 /// <include file='doc\XmlSchemaExporter.uex' path='docs/doc[@for="XmlSchemaExporter.ExportMembersMapping1"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public void ExportMembersMapping(XmlMembersMapping xmlMembersMapping, bool exportEnclosingType) {
     xmlMembersMapping.CheckShallow();
     MembersMapping mapping = (MembersMapping)xmlMembersMapping.Accessor.Mapping;
     CheckScope(xmlMembersMapping.Scope);
     if (mapping.HasWrapperElement && exportEnclosingType) {
         ExportElement(xmlMembersMapping.Accessor);
     }
     else {
         foreach (MemberMapping member in mapping.Members) {
             if (member.Attribute != null) 
                 throw new InvalidOperationException(Res.GetString(Res.XmlBareAttributeMember, member.Attribute.Name));
             else if (member.Text != null) 
                 throw new InvalidOperationException(Res.GetString(Res.XmlBareTextMember, member.Text.Name));
             else if (member.Elements == null || member.Elements.Length == 0)
                 continue;
             
             if (member.TypeDesc.IsArrayLike && !(member.Elements[0].Mapping is ArrayMapping)) 
                 throw new InvalidOperationException(Res.GetString(Res.XmlIllegalArrayElement, member.Elements[0].Name));
             
             if (exportEnclosingType) {
                 ExportElement(member.Elements[0]);
             }
             else {
                 ExportMapping(member.Elements[0].Mapping, member.Elements[0].Namespace, member.Elements[0].Any);
             }
         }
     }
     ExportRootIfNecessary(xmlMembersMapping.Scope);
 }
开发者ID:uQr,项目名称:referencesource,代码行数:33,代码来源:XmlSchemaExporter.cs


示例3: ExportMembersMapping

 /// <include file='doc\SoapCodeExporter.uex' path='docs/doc[@for="SoapCodeExporter.ExportMembersMapping"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public void ExportMembersMapping(XmlMembersMapping xmlMembersMapping) {
     CheckScope(xmlMembersMapping.Scope);
     CheckNamespace();
     for (int i = 0; i < xmlMembersMapping.Count; i++) {
         ExportElement((ElementAccessor)xmlMembersMapping[i].Accessor);
     }
 }
开发者ID:ArildF,项目名称:masters,代码行数:11,代码来源:soapcodeexporter.cs


示例4: ExportMembersMapping

        /// <include file='doc\XmlCodeExporter.uex' path='docs/doc[@for="XmlCodeExporter.ExportMembersMapping"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public void ExportMembersMapping(XmlMembersMapping xmlMembersMapping)
        {
            xmlMembersMapping.CheckShallow();
            CheckScope(xmlMembersMapping.Scope);

            for (int i = 0; i < xmlMembersMapping.Count; i++)
            {
                AccessorMapping mapping = xmlMembersMapping[i].Mapping;
                if (mapping.Xmlns == null)
                {
                    if (mapping.Attribute != null)
                    {
                        ExportType(mapping.Attribute.Mapping, Accessor.UnescapeName(mapping.Attribute.Name), mapping.Attribute.Namespace, null, false);
                    }
                    if (mapping.Elements != null)
                    {
                        for (int j = 0; j < mapping.Elements.Length; j++)
                        {
                            ElementAccessor element = mapping.Elements[j];
                            ExportType(element.Mapping, Accessor.UnescapeName(element.Name), element.Namespace, null, false);
                        }
                    }
                    if (mapping.Text != null)
                    {
                        ExportType(mapping.Text.Mapping, Accessor.UnescapeName(mapping.Text.Name), mapping.Text.Namespace, null, false);
                    }
                }
            }
        }
开发者ID:Corillian,项目名称:corefx,代码行数:33,代码来源:XmlCodeExporter.cs


示例5: Add

 internal void Add(MessagePartDescription part, XmlMemberMapping memberMapping, XmlMembersMapping membersMapping, bool isEncoded)
 {
     PartInfo partInfo = new PartInfo();
     partInfo.MemberMapping = memberMapping;
     partInfo.MembersMapping = membersMapping;
     partInfo.IsEncoded = isEncoded;
     partInfoTable[part] = partInfo;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:8,代码来源:XmlSerializerOperationGenerator.cs


示例6: SoapParameters

        internal SoapParameters(XmlMembersMapping request, XmlMembersMapping response, string[] parameterOrder, CodeIdentifiers identifiers) {
            ArrayList requestList = new ArrayList();
            ArrayList responseList = new ArrayList();

            AddMappings(requestList, request);
            if (response != null) AddMappings(responseList, response);

            if (parameterOrder != null) {
                for (int i = 0; i < parameterOrder.Length; i++) {
                    string elementName = parameterOrder[i];
                    XmlMemberMapping requestMapping = FindMapping(requestList, elementName);
                    SoapParameter parameter = new SoapParameter();
                    if (requestMapping != null) {
                        if (RemoveByRefMapping(responseList, requestMapping))
                            parameter.codeFlags = CodeFlags.IsByRef;
                        parameter.mapping = requestMapping;
                        requestList.Remove(requestMapping);
                        AddParameter(parameter);
                    }
                    else {
                        XmlMemberMapping responseMapping = FindMapping(responseList, elementName);
                        if (responseMapping != null) {
                            parameter.codeFlags = CodeFlags.IsOut;
                            parameter.mapping = responseMapping;
                            responseList.Remove(responseMapping);
                            AddParameter(parameter);
                        }
                    }
                }
            }

            foreach (XmlMemberMapping requestMapping in requestList) {
                SoapParameter parameter = new SoapParameter();
                if (RemoveByRefMapping(responseList, requestMapping))
                    parameter.codeFlags = CodeFlags.IsByRef;
                parameter.mapping = requestMapping;
                AddParameter(parameter);
            }

            if (responseList.Count > 0) {
                if (!((XmlMemberMapping) responseList[0]).CheckSpecified) {
                    ret = (XmlMemberMapping)responseList[0];
                    responseList.RemoveAt(0);
                }
                foreach (XmlMemberMapping responseMapping in responseList) {
                    SoapParameter parameter = new SoapParameter();
                    parameter.mapping = responseMapping;
                    parameter.codeFlags = CodeFlags.IsOut;
                    AddParameter(parameter);
                }
            }

            foreach (SoapParameter parameter in parameters) {
                parameter.name = identifiers.MakeUnique(CodeIdentifier.MakeValid(parameter.mapping.MemberName));
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:56,代码来源:SoapProtocolImporter.cs


示例7: ExportMembersMapping

        /// <include file='doc\XmlCodeExporter.uex' path='docs/doc[@for="XmlCodeExporter.ExportMembersMapping"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public void ExportMembersMapping(XmlMembersMapping xmlMembersMapping) {
            CheckScope(xmlMembersMapping.Scope);
            CheckNamespace();

            for (int i = 0; i < xmlMembersMapping.Count; i++) {
                Accessor accessor = xmlMembersMapping[i].Accessor;
                if (!(accessor is XmlnsAccessor)) {
                    ExportType(accessor.Mapping, Accessor.UnescapeName(accessor.Name), accessor.Namespace, null);
                }
            }
        }
开发者ID:ArildF,项目名称:masters,代码行数:15,代码来源:xmlcodeexporter.cs


示例8: ExportMembersMapping

 /// <include file='doc\SoapSchemaExporter.uex' path='docs/doc[@for="SoapSchemaExporter.ExportMembersMapping1"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public void ExportMembersMapping(XmlMembersMapping xmlMembersMapping, bool exportEnclosingType) {
     CheckScope(xmlMembersMapping.Scope);
     MembersMapping membersMapping = (MembersMapping)xmlMembersMapping.Accessor.Mapping;
     if (exportEnclosingType) {
         ExportTypeMapping(membersMapping, null);
     }
     else {
         foreach (MemberMapping memberMapping in membersMapping.Members) {
             if (memberMapping.Elements.Length > 0) 
                 ExportTypeMapping(memberMapping.Elements[0].Mapping, null);
         }
     }
 }
开发者ID:ArildF,项目名称:masters,代码行数:17,代码来源:soapschemaexporter.cs


示例9: ExportTypeMapping

 /// <include file='doc\XmlSchemaExporter.uex' path='docs/doc[@for="XmlSchemaExporter.ExportTypeMapping1"]/*' />
 public XmlQualifiedName ExportTypeMapping(XmlMembersMapping xmlMembersMapping) {
     xmlMembersMapping.CheckShallow();
     CheckScope(xmlMembersMapping.Scope);
     MembersMapping mapping = (MembersMapping)xmlMembersMapping.Accessor.Mapping;
     if (mapping.Members.Length == 1 && mapping.Members[0].Elements[0].Mapping is SpecialMapping) {
         SpecialMapping special = (SpecialMapping)mapping.Members[0].Elements[0].Mapping;
         XmlSchemaType type = ExportSpecialMapping(special, xmlMembersMapping.Accessor.Namespace, false, null);
         if (type != null && type.Name != null && type.Name.Length > 0) {
             type.Name = xmlMembersMapping.Accessor.Name;
             AddSchemaItem(type, xmlMembersMapping.Accessor.Namespace, null);
         }
         ExportRootIfNecessary(xmlMembersMapping.Scope);
         return (new XmlQualifiedName(xmlMembersMapping.Accessor.Name, xmlMembersMapping.Accessor.Namespace));
     }
     return null;
 }
开发者ID:uQr,项目名称:referencesource,代码行数:17,代码来源:XmlSchemaExporter.cs


示例10: ImportMembersMapping

        /// <include file='doc\SoapReflectionImporter.uex' path='docs/doc[@for="SoapReflectionImporter.ImportMembersMapping3"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public XmlMembersMapping ImportMembersMapping(string elementName, string ns, XmlReflectionMember[] members, bool hasWrapperElement, bool writeAccessors, bool validate, XmlMappingAccess access) {
            ElementAccessor element = new ElementAccessor();
            element.IsSoap = true;
            element.Name = elementName == null || elementName.Length == 0 ? elementName : XmlConvert.EncodeLocalName(elementName);

            element.Mapping = ImportMembersMapping(members, ns, hasWrapperElement, writeAccessors, validate);
            element.Mapping.TypeName = elementName;
            element.Namespace = element.Mapping.Namespace == null ? ns : element.Mapping.Namespace;
            element.Form = XmlSchemaForm.Qualified;
            XmlMembersMapping xmlMapping = new XmlMembersMapping(typeScope, element, access);
            xmlMapping.IsSoap = true;
            xmlMapping.GenerateSerializer = true;
            return xmlMapping;
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:18,代码来源:soapreflectionimporter.cs


示例11: GenerateEncodedMembersElement

        string GenerateEncodedMembersElement(XmlMembersMapping xmlMembersMapping) {
            ElementAccessor element = xmlMembersMapping.Accessor;
            MembersMapping membersMapping = (MembersMapping)element.Mapping;
            MemberMapping[] mappings = membersMapping.Members;
            bool hasWrapperElement = membersMapping.HasWrapperElement;
            bool writeAccessors = membersMapping.WriteAccessors;
            string methodName = NextMethodName(element.Name);
            Writer.WriteLine();
            Writer.Write("public object[] ");
            Writer.Write(methodName);
            Writer.WriteLine("() {");
            Writer.Indent++;

            Writer.WriteLine("Reader.MoveToContent();");

            Writer.Write("object[] p = new object[");
            Writer.Write(mappings.Length.ToString(CultureInfo.InvariantCulture));
            Writer.WriteLine("];");
            InitializeValueTypes("p", mappings);

            if (hasWrapperElement) {
                WriteReadNonRoots();

                if (membersMapping.ValidateRpcWrapperElement) {
                    Writer.Write("if (!");
                    WriteXmlNodeEqual("Reader", element.Name, element.Form == XmlSchemaForm.Qualified ? element.Namespace : "");
                    Writer.WriteLine(") throw CreateUnknownNodeException();");
                }
                Writer.WriteLine("bool isEmptyWrapper = Reader.IsEmptyElement;");
                Writer.WriteLine("Reader.ReadStartElement();");
            }

            Member[] members = new Member[mappings.Length];
            for (int i = 0; i < mappings.Length; i++) {
                MemberMapping mapping = mappings[i];
                string source = "p[" + i.ToString(CultureInfo.InvariantCulture) + "]";
                string arraySource = source;
                if (mapping.Xmlns != null) {
                    arraySource = "((" + mapping.TypeDesc.CSharpName + ")" + source + ")";
                }
                Member member = new Member(this,source, arraySource, "a", i, mapping);
                if (!mapping.IsSequence)
                    member.ParamsReadSource = "paramsRead[" + i.ToString(CultureInfo.InvariantCulture) + "]";
                members[i] = member;

                if (mapping.CheckSpecified == SpecifiedAccessor.ReadWrite) {
                    string nameSpecified = mapping.Name + "Specified";
                    for (int j = 0; j < mappings.Length; j++) {
                        if (mappings[j].Name == nameSpecified) {
                            member.CheckSpecifiedSource = "p[" + j.ToString(CultureInfo.InvariantCulture) + "]";
                            break;
                        }
                    }
                }

            }

            string fixupMethodName = "fixup_" + methodName;
            bool anyFixups = WriteMemberFixupBegin(members, fixupMethodName, "p");

            if (members.Length > 0 && members[0].Mapping.IsReturnValue) Writer.WriteLine("IsReturnValue = true;");

            string checkTypeHrefSource = (!hasWrapperElement && !writeAccessors) ? "hrefList" : null;
            if (checkTypeHrefSource != null)
                WriteInitCheckTypeHrefList(checkTypeHrefSource);
                     
            WriteParamsRead(mappings.Length);
            int loopIndex = WriteWhileNotLoopStart();
            Writer.Indent++;

            string unrecognizedElementSource = checkTypeHrefSource == null ? "UnknownNode((object)p);" : "if (Reader.GetAttribute(\"id\", null) != null) { ReadReferencedElement(); } else { UnknownNode((object)p); }";
            WriteMemberElements(members, unrecognizedElementSource, "UnknownNode((object)p);", null, null, checkTypeHrefSource);
            Writer.WriteLine("Reader.MoveToContent();");

            WriteWhileLoopEnd(loopIndex);

            if (hasWrapperElement)
                Writer.WriteLine("if (!isEmptyWrapper) ReadEndElement();");

            if (checkTypeHrefSource != null)
                WriteHandleHrefList(members, checkTypeHrefSource);

            Writer.WriteLine("ReadReferencedElements();");
            Writer.WriteLine("return p;");

            Writer.Indent--;
            Writer.WriteLine("}");

            if (anyFixups) WriteFixupMethod(fixupMethodName, members, "object[]", false, false, "p");
          
            return methodName;
        }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:92,代码来源:XmlSerializationReader.cs


示例12: GenerateMembersElement

 string GenerateMembersElement(XmlMembersMapping xmlMembersMapping) {
     if (xmlMembersMapping.Accessor.IsSoap)
         return GenerateEncodedMembersElement(xmlMembersMapping);
     else
         return GenerateLiteralMembersElement(xmlMembersMapping);
 }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:6,代码来源:XmlSerializationReader.cs


示例13: CreateLiteralMessage

 void CreateLiteralMessage(Message message, MessageBinding messageBinding, XmlMembersMapping members, bool wrapped, bool rpc) {
     if (members.Count == 1 && members[0].Any && members[0].ElementName.Length == 0 && !wrapped) {
         string typeName = SchemaExporter.ExportAnyType(members[0].Namespace);
         MessagePart part = new MessagePart();
         part.Name = members[0].MemberName;
         part.Type = new XmlQualifiedName(typeName, members[0].Namespace);
         message.Parts.Add(part);
     }
     else {
         SchemaExporter.ExportMembersMapping(members, !rpc);
         if (wrapped) {
             MessagePart part = new MessagePart();
             part.Name = "parameters";
             part.Element = new XmlQualifiedName(members.XsdElementName, members.Namespace);
             message.Parts.Add(part);
         }
         else {
             for (int i = 0; i < members.Count; i++) {
                 XmlMemberMapping member = members[i];
                 MessagePart part = new MessagePart();
                 if (rpc) {
                     // Generate massage part with the type attribute
                     if (member.TypeName == null || member.TypeName.Length == 0) {
                         throw new InvalidOperationException(Res.GetString(Res.WsdlGenRpcLitAnonimousType, Method.DeclaringType.Name, Method.Name, member.MemberName));
                     }
                     part.Name = member.XsdElementName;
                     part.Type = new XmlQualifiedName(member.TypeName, member.TypeNamespace);
                 }
                 else {
                     part.Name = XmlConvert.EncodeLocalName(member.MemberName);
                     part.Element = new XmlQualifiedName(member.XsdElementName, member.Namespace);
                 }
                 message.Parts.Add(part);
             }
         }
     }
     messageBinding.Extensions.Add(CreateSoapBodyBinding(SoapBindingUse.Literal, rpc ? members.Namespace : null));
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:38,代码来源:SoapProtocolReflector.cs


示例14: GenerateMethod

		CodeMemberMethod GenerateMethod (CodeIdentifiers memberIds, HttpOperationBinding httpOper, XmlMembersMapping inputMembers, XmlTypeMapping outputMember)
		{
			CodeIdentifiers pids = new CodeIdentifiers ();
			CodeMemberMethod method = new CodeMemberMethod ();
			CodeMemberMethod methodBegin = new CodeMemberMethod ();
			CodeMemberMethod methodEnd = new CodeMemberMethod ();
			method.Attributes = MemberAttributes.Public;
			methodBegin.Attributes = MemberAttributes.Public;
			methodEnd.Attributes = MemberAttributes.Public;
			
			// Find unique names for temporary variables
			
			for (int n=0; n<inputMembers.Count; n++)
				pids.AddUnique (inputMembers[n].MemberName, inputMembers[n]);

			string varAsyncResult = pids.AddUnique ("asyncResult","asyncResult");
			string varCallback = pids.AddUnique ("callback","callback");
			string varAsyncState = pids.AddUnique ("asyncState","asyncState");

			string messageName = memberIds.AddUnique(CodeIdentifier.MakeValid(Operation.Name),method);

			method.Name = Operation.Name;
			methodBegin.Name = memberIds.AddUnique(CodeIdentifier.MakeValid("Begin" + Operation.Name),method);
			methodEnd.Name = memberIds.AddUnique(CodeIdentifier.MakeValid("End" + Operation.Name),method);

			method.ReturnType = new CodeTypeReference (typeof(void));
			methodEnd.ReturnType = new CodeTypeReference (typeof(void));
			methodEnd.Parameters.Add (new CodeParameterDeclarationExpression (typeof (IAsyncResult),varAsyncResult));

			CodeExpression[] paramArray = new CodeExpression [inputMembers.Count];

			for (int n=0; n<inputMembers.Count; n++)
			{
				string ptype = GetSimpleType (inputMembers[n]);
				CodeParameterDeclarationExpression param = new CodeParameterDeclarationExpression (ptype, inputMembers[n].MemberName);
				
				param.Direction = FieldDirection.In;
				method.Parameters.Add (param);
				methodBegin.Parameters.Add (param);
				paramArray [n] = new CodeVariableReferenceExpression (param.Name);
			}

			bool isVoid = true;
			if (outputMember != null)
			{
				method.ReturnType = new CodeTypeReference (outputMember.TypeFullName);
				methodEnd.ReturnType = new CodeTypeReference (outputMember.TypeFullName);
				xmlExporter.AddMappingMetadata (method.ReturnTypeCustomAttributes, outputMember, "");
				isVoid = false;
			}

			methodBegin.Parameters.Add (new CodeParameterDeclarationExpression (typeof (AsyncCallback),varCallback));
			methodBegin.Parameters.Add (new CodeParameterDeclarationExpression (typeof (object),varAsyncState));
			methodBegin.ReturnType = new CodeTypeReference (typeof(IAsyncResult));

			// Array of input parameters
			
			CodeArrayCreateExpression methodParams;
			if (paramArray.Length > 0)
				methodParams = new CodeArrayCreateExpression (typeof(object), paramArray);
			else
				methodParams = new CodeArrayCreateExpression (typeof(object), 0);

			// Generate method url
			
			CodeThisReferenceExpression ethis = new CodeThisReferenceExpression();
			
			CodeExpression thisURlExp = new CodeFieldReferenceExpression (ethis, "Url");
			CodePrimitiveExpression metUrl = new CodePrimitiveExpression (httpOper.Location);
			CodeBinaryOperatorExpression expMethodLocation = new CodeBinaryOperatorExpression (thisURlExp, CodeBinaryOperatorType.Add, metUrl);
			
			// Invoke call
			
			CodePrimitiveExpression varMsgName = new CodePrimitiveExpression (messageName);
			CodeMethodInvokeExpression inv;

			inv = new CodeMethodInvokeExpression (ethis, "Invoke", varMsgName, expMethodLocation, methodParams);
			if (!isVoid)
				method.Statements.Add (new CodeMethodReturnStatement (new CodeCastExpression (method.ReturnType, inv)));
			else
				method.Statements.Add (inv);
			
			// Begin Invoke Call
			
			CodeExpression expCallb = new CodeVariableReferenceExpression (varCallback);
			CodeExpression expAsyncs = new CodeVariableReferenceExpression (varAsyncState);
			inv = new CodeMethodInvokeExpression (ethis, "BeginInvoke", varMsgName, expMethodLocation, methodParams, expCallb, expAsyncs);
			methodBegin.Statements.Add (new CodeMethodReturnStatement (inv));
			
			// End Invoke call
			
			CodeExpression varAsyncr = new CodeVariableReferenceExpression (varAsyncResult);
			inv = new CodeMethodInvokeExpression (ethis, "EndInvoke", varAsyncr);
			if (!isVoid)
				methodEnd.Statements.Add (new CodeMethodReturnStatement (new CodeCastExpression (methodEnd.ReturnType, inv)));
			else
				methodEnd.Statements.Add (inv);
			
			// Attributes

//.........这里部分代码省略.........
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:101,代码来源:HttpSimpleProtocolImporter.cs


示例15: GenerateReturnAttributes

		void GenerateReturnAttributes (XmlMembersMapping members, XmlMemberMapping member, SoapBindingUse use, CodeMemberMethod method)
		{
			if (use == SoapBindingUse.Literal)
				xmlExporter.AddMappingMetadata (method.ReturnTypeCustomAttributes, member, members.Namespace, (member.ElementName != method.Name + "Result"));
			else
				soapExporter.AddMappingMetadata (method.ReturnTypeCustomAttributes, member, (member.ElementName != method.Name + "Result"));
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:SoapProtocolImporter.cs


示例16: GenerateMethod

		CodeMemberMethod GenerateMethod (CodeIdentifiers memberIds, SoapOperationBinding soapOper, SoapBodyBinding bodyBinding, XmlMembersMapping inputMembers, XmlMembersMapping outputMembers)
		{
			CodeIdentifiers pids = new CodeIdentifiers ();
			CodeMemberMethod method = new CodeMemberMethod ();
			CodeMemberMethod methodBegin = new CodeMemberMethod ();
			CodeMemberMethod methodEnd = new CodeMemberMethod ();
			method.Attributes = MemberAttributes.Public | MemberAttributes.Final;
			methodBegin.Attributes = MemberAttributes.Public | MemberAttributes.Final;
			methodEnd.Attributes = MemberAttributes.Public | MemberAttributes.Final;
			
			SoapBindingStyle style = soapOper.Style != SoapBindingStyle.Default ? soapOper.Style : soapBinding.Style;
			
			// Find unique names for temporary variables
			
			for (int n=0; n<inputMembers.Count; n++)
				pids.AddUnique (inputMembers[n].MemberName, inputMembers[n]);

			if (outputMembers != null)
				for (int n=0; n<outputMembers.Count; n++)
					pids.AddUnique (outputMembers[n].MemberName, outputMembers[n]);
				
			string varAsyncResult = pids.AddUnique ("asyncResult","asyncResult");
			string varResults = pids.AddUnique ("results","results");
			string varCallback = pids.AddUnique ("callback","callback");
			string varAsyncState = pids.AddUnique ("asyncState","asyncState");

			string messageName = memberIds.AddUnique(CodeIdentifier.MakeValid(Operation.Name),method);

			method.Name = CodeIdentifier.MakeValid(Operation.Name);
			if (method.Name == ClassName) method.Name += "1";
			methodBegin.Name = memberIds.AddUnique(CodeIdentifier.MakeValid("Begin" + method.Name),method);
			methodEnd.Name = memberIds.AddUnique(CodeIdentifier.MakeValid("End" + method.Name),method);

			method.ReturnType = new CodeTypeReference (typeof(void));
			methodEnd.ReturnType = new CodeTypeReference (typeof(void));
			methodEnd.Parameters.Add (new CodeParameterDeclarationExpression (typeof (IAsyncResult),varAsyncResult));

			CodeExpression[] paramArray = new CodeExpression [inputMembers.Count];
			CodeParameterDeclarationExpression[] outParams = new CodeParameterDeclarationExpression [outputMembers != null ? outputMembers.Count : 0];

			for (int n=0; n<inputMembers.Count; n++)
			{
				CodeParameterDeclarationExpression param = GenerateParameter (inputMembers[n], FieldDirection.In);
				method.Parameters.Add (param);
				GenerateMemberAttributes (inputMembers, inputMembers[n], bodyBinding.Use, param);
				methodBegin.Parameters.Add (GenerateParameter (inputMembers[n], FieldDirection.In));
				paramArray [n] = new CodeVariableReferenceExpression (param.Name);
			}

			if (outputMembers != null)
			{
				bool hasReturn = false;
				for (int n=0; n<outputMembers.Count; n++)
				{
					CodeParameterDeclarationExpression cpd = GenerateParameter (outputMembers[n], FieldDirection.Out);
					outParams [n] = cpd;
					
					bool found = false;
					foreach (CodeParameterDeclarationExpression ip in method.Parameters)
					{
						if (ip.Name == cpd.Name && ip.Type.BaseType == cpd.Type.BaseType) {
							ip.Direction = FieldDirection.Ref;
							methodEnd.Parameters.Add (GenerateParameter (outputMembers[n], FieldDirection.Out));
							found = true;
							break;
						}
					}
					
					if (found) continue;
	
					if (!hasReturn) 
					{
						hasReturn = true;
						method.ReturnType = cpd.Type;
						methodEnd.ReturnType = cpd.Type;
						GenerateReturnAttributes (outputMembers, outputMembers[n], bodyBinding.Use, method);
						outParams [n] = null;
						continue;
					}
					
					method.Parameters.Add (cpd);
					GenerateMemberAttributes (outputMembers, outputMembers[n], bodyBinding.Use, cpd);
					methodEnd.Parameters.Add (GenerateParameter (outputMembers[n], FieldDirection.Out));
				}
			}
			
			methodBegin.Parameters.Add (new CodeParameterDeclarationExpression (typeof (AsyncCallback),varCallback));
			methodBegin.Parameters.Add (new CodeParameterDeclarationExpression (typeof (object),varAsyncState));
			methodBegin.ReturnType = new CodeTypeReference (typeof(IAsyncResult));

			// Array of input parameters
			
			CodeArrayCreateExpression methodParams;
			if (paramArray.Length > 0)
				methodParams = new CodeArrayCreateExpression (typeof(object), paramArray);
			else
				methodParams = new CodeArrayCreateExpression (typeof(object), 0);

			// Assignment of output parameters
			
//.........这里部分代码省略.........
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:101,代码来源:SoapProtocolImporter.cs


示例17: GenerateMemberAttributes

		void GenerateMemberAttributes (XmlMembersMapping members, XmlMemberMapping member, SoapBindingUse use, CodeParameterDeclarationExpression param)
		{
			if (use == SoapBindingUse.Literal)
				xmlExporter.AddMappingMetadata (param.CustomAttributes, member, members.Namespace);
			else
				soapExporter.AddMappingMetadata (param.CustomAttributes, member);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:SoapProtocolImporter.cs


示例18: ExportTypeMapping

 public XmlQualifiedName ExportTypeMapping(XmlMembersMapping xmlMembersMapping)
 {
     xmlMembersMapping.CheckShallow();
     this.CheckScope(xmlMembersMapping.Scope);
     MembersMapping mapping = (MembersMapping) xmlMembersMapping.Accessor.Mapping;
     if ((mapping.Members.Length != 1) || !(mapping.Members[0].Elements[0].Mapping is SpecialMapping))
     {
         return null;
     }
     SpecialMapping mapping2 = (SpecialMapping) mapping.Members[0].Elements[0].Mapping;
     XmlSchemaType item = this.ExportSpecialMapping(mapping2, xmlMembersMapping.Accessor.Namespace, false, null);
     if (((item != null) && (item.Name != null)) && (item.Name.Length > 0))
     {
         item.Name = xmlMembersMapping.Accessor.Name;
         this.AddSchemaItem(item, xmlMembersMapping.Accessor.Namespace, null);
     }
     this.ExportRootIfNecessary(xmlMembersMapping.Scope);
     return new XmlQualifiedName(xmlMembersMapping.Accessor.Name, xmlMembersMapping.Accessor.Namespace);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:19,代码来源:XmlSchemaExporter.cs


示例19: ImportMembersMapping

		XmlMembersMapping ImportMembersMapping (string elementName, 
			string ns, 
			XmlReflectionMember[] members, 
			bool hasWrapperElement, 
			bool writeAccessors, 
			bool validate,
			XmlMappingAccess access)
		{
//			Reset ();	Disabled. See ChangeLog

			ArrayList mapping = new ArrayList ();
			for (int n=0; n<members.Length; n++)
			{
				if (members[n].XmlAttributes.XmlIgnore) continue;
				XmlTypeMapMember mapMem = CreateMapMember (null, members[n], ns);
				mapMem.GlobalIndex = n;
				mapMem.CheckOptionalValueType (members);
				mapping.Add (new XmlMemberMapping (members[n].MemberName, ns, mapMem, false));
			}
			elementName = XmlConvert.EncodeLocalName (elementName);
			XmlMembersMapping mps = new XmlMembersMapping (elementName, ns, hasWrapperElement, false, (XmlMemberMapping[])mapping.ToArray (typeof(XmlMemberMapping)));
			mps.RelatedMaps = relatedMaps;
			mps.Format = SerializationFormat.Literal;
			Type[] extraTypes = includedTypes != null ? (Type[])includedTypes.ToArray(typeof(Type)) : null;
#if !NET_2_1
			mps.Source = new MembersSerializationSource (elementName, hasWrapperElement, members, false, true, ns, extraTypes);
			if (allowPrivateTypes) mps.Source.CanBeGenerated = false;
#endif
			return mps;
		}
开发者ID:anand-bhola,项目名称:mono,代码行数:30,代码来源:XmlReflectionImporter.cs


示例20: ExportAnyType

 public string ExportAnyType(XmlMembersMapping members)
 {
     if (((members.Count != 1) || !members[0].Any) || (members[0].ElementName.Length != 0))
     {
         return null;
     }
     XmlMemberMapping mapping = members[0];
     string ns = mapping.Namespace;
     bool isArrayLike = mapping.Mapping.TypeDesc.IsArrayLike;
     bool mixed = (isArrayLike && (mapping.Mapping.TypeDesc.ArrayElementTypeDesc != null)) ? mapping.Mapping.TypeDesc.ArrayElementTypeDesc.IsMixed : mapping.Mapping.TypeDesc.IsMixed;
     if (mixed && mapping.Mapping.TypeDesc.IsMixed)
     {
         isArrayLike = true;
     }
     string str2 = mixed ? "any" : (isArrayLike ? "anyElements" : "anyElement");
     string name = str2;
     int num = 0;
     XmlSchema schema = this.schemas[ns];
     if (schema != null)
     {
         while (true)
         {
             XmlSchemaType schemaType = FindSchemaType(name, schema.Items);
             if (schemaType == null)
             {
                 break;
             }
             if (IsAnyType(schemaType, mixed, isArrayLike))
             {
                 return name;
             }
             num++;
             name = str2 + num.ToString(CultureInfo.InvariantCulture);
         }
     }
     XmlSchemaComplexType item = new XmlSchemaComplexType {
         Name = name,
         IsMixed = mixed
     };
     XmlSchemaSequence sequence = new XmlSchemaSequence();
     XmlSchemaAny any = new XmlSchemaAny {
         MinOccurs = 0M
     };
     if (isArrayLike)
     {
         any.MaxOccurs = 79228162514264337593543950335M;
     }
     sequence.Items.Add(any);
     item.Particle = sequence;
     this.AddSchemaItem(item, ns, null);
     return name;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:52,代码来源:XmlSchemaExporter.cs



注:本文中的System.Xml.Serialization.XmlMembersMapping类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Serialization.XmlReflectionImporter类代码示例发布时间:2022-05-26
下一篇:
C# Serialization.XmlMapping类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap