Exemplo n.º 1
0
        private void GeneratePartType(Dictionary <XmlMembersMapping, XmlMembersMapping> alreadyExported, MessagePartDescription part, string partNamespace)
        {
            if (!partInfoTable.ContainsKey(part))
            {
                return;
            }
            PartInfo          partInfo       = partInfoTable[part];
            XmlMembersMapping membersMapping = partInfo.MembersMapping;
            XmlMemberMapping  memberMapping  = partInfo.MemberMapping;

            if (!alreadyExported.ContainsKey(membersMapping))
            {
                if (partInfo.IsEncoded)
                {
                    SoapExporter.ExportMembersMapping(membersMapping);
                }
                else
                {
                    XmlExporter.ExportMembersMapping(membersMapping);
                }
                alreadyExported.Add(membersMapping, membersMapping);
            }
            CodeAttributeDeclarationCollection additionalAttributes = new CodeAttributeDeclarationCollection();

            if (partInfo.IsEncoded)
            {
                SoapExporter.AddMappingMetadata(additionalAttributes, memberMapping, false /*forceUseMemberName*/);
            }
            else
            {
                XmlExporter.AddMappingMetadata(additionalAttributes, memberMapping, partNamespace, false /*forceUseMemberName*/);
            }
            part.BaseType = GetTypeName(memberMapping);
            operationGenerator.ParameterTypes.Add(part, new CodeTypeReference(part.BaseType));
            operationGenerator.ParameterAttributes.Add(part, additionalAttributes);
        }