当前位置: 首页>>代码示例>>C#>>正文


C# Description.MessagePartDescription类代码示例

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


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

示例1: AddPingToContractDescription

        /// <summary>
        /// Add the Ping method to the existing contract
        /// </summary>
        private void AddPingToContractDescription(ContractDescription contractDescription)
        {
            OperationDescription pingOperationDescription = new OperationDescription(PingOperationName, contractDescription);

            MessageDescription inputMessageDescription = new MessageDescription(
                GetAction(contractDescription, PingOperationName),
                MessageDirection.Input);

            MessageDescription outputMessageDescription = new MessageDescription(
                GetAction(contractDescription, PingResponse),
                MessageDirection.Output);

            MessagePartDescription returnValue = new MessagePartDescription("PingResult", contractDescription.Namespace);

            returnValue.Type = typeof(DateTime);
            outputMessageDescription.Body.ReturnValue = returnValue;

            inputMessageDescription.Body.WrapperName = PingOperationName;
            inputMessageDescription.Body.WrapperNamespace = contractDescription.Namespace;
            outputMessageDescription.Body.WrapperName = PingResponse;
            outputMessageDescription.Body.WrapperNamespace = contractDescription.Namespace;

            pingOperationDescription.Messages.Add(inputMessageDescription);
            pingOperationDescription.Messages.Add(outputMessageDescription);

            pingOperationDescription.Behaviors.Add(new DataContractSerializerOperationBehavior(pingOperationDescription));
            pingOperationDescription.Behaviors.Add(new PingOperationBehavior());

            contractDescription.Operations.Add(pingOperationDescription);
        }
开发者ID:serbrech,项目名称:WCFPing,代码行数:33,代码来源:PingEndpointBehavior.cs

示例2: ValidateMessagePartDescription

 private void ValidateMessagePartDescription(MessagePartDescription part)
 {
     if (part != null)
     {
         this.ValidateCustomSerializableType(part.Type);
     }
 }
开发者ID:JonasSyrstad,项目名称:Stardust,代码行数:7,代码来源:NewSerializerContract.cs

示例3: 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

示例4: CreateReflectionMember

		private XmlReflectionMember CreateReflectionMember (MessagePartDescription partDesc, bool isReturnValue)
		{
			XmlReflectionMember m = new XmlReflectionMember ();
			m.IsReturnValue = isReturnValue;
			m.MemberName = partDesc.Name;
			m.MemberType = partDesc.Type;
			return m;
		}
开发者ID:nickchal,项目名称:pash,代码行数:8,代码来源:XmlMessagesFormatter.cs

示例5: CreateReflectionMember

		private XmlReflectionMember CreateReflectionMember (MessagePartDescription partDesc, bool isReturnValue)
		{
			XmlReflectionMember m = new XmlReflectionMember ();
			m.IsReturnValue = isReturnValue;
			m.MemberName = partDesc.Name;
			m.MemberType = partDesc.Type;
			m.XmlAttributes = partDesc.MemberInfo == null ? new XmlAttributes () : new XmlAttributes (partDesc.MemberInfo);
			return m;
		}
开发者ID:nlhepler,项目名称:mono,代码行数:9,代码来源:XmlMessagesFormatter.cs

示例6: RequestMessagePartDescription

 public RequestMessagePartDescription(MessagePartDescription messagePart, MessagePartType partType, string alias)
     : base(messagePart.Name, messagePart.Namespace)
 {
     Index = messagePart.Index;
     MemberInfo = messagePart.MemberInfo;
     Multiple = messagePart.Multiple;
     ProtectionLevel = messagePart.ProtectionLevel;
     Type = messagePart.Type;
     Alias = alias;
     PartType = partType;
 }
开发者ID:huoxudong125,项目名称:WcfRestContrib,代码行数:11,代码来源:RequestMessagePartDescription.cs

示例7: GetXmlReflectionMember

 internal static XmlReflectionMember GetXmlReflectionMember(MessagePartDescription part, bool isRpc, bool isEncoded, bool isWrapped)
 {
     string ns = isRpc ? null : part.Namespace;
     ICustomAttributeProvider additionalAttributesProvider = null;
     if (isEncoded || (part.AdditionalAttributesProvider is MemberInfo))
     {
         additionalAttributesProvider = part.AdditionalAttributesProvider;
     }
     System.ServiceModel.Description.XmlName memberName = string.IsNullOrEmpty(part.UniquePartName) ? null : new System.ServiceModel.Description.XmlName(part.UniquePartName, true);
     System.ServiceModel.Description.XmlName xmlName = part.XmlName;
     return GetXmlReflectionMember(memberName, xmlName, ns, part.Type, additionalAttributesProvider, part.Multiple, isEncoded, isWrapped);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:XmlSerializerHelper.cs

示例8: StreamFormatter

 private StreamFormatter(MessageDescription messageDescription, MessagePartDescription streamPart, string operationName, bool isRequest)
 {
     if ((object)streamPart == (object)messageDescription.Body.ReturnValue)
         _streamIndex = returnValueIndex;
     else
         _streamIndex = streamPart.Index;
     _wrapperName = messageDescription.Body.WrapperName;
     _wrapperNS = messageDescription.Body.WrapperNamespace;
     _partName = streamPart.Name;
     _partNS = streamPart.Namespace;
     _isRequest = isRequest;
     _operationName = operationName;
 }
开发者ID:dmetzgar,项目名称:wcf,代码行数:13,代码来源:StreamFormatter.cs

示例9: MessagePartDescription

 internal MessagePartDescription(MessagePartDescription other)
 {
     this.name = other.name;
     this.ns = other.ns;
     this.index = other.index;
     this.type = other.type;
     this.serializationPosition = other.serializationPosition;
     this.hasProtectionLevel = other.hasProtectionLevel;
     this.protectionLevel = other.protectionLevel;
     this.memberInfo = other.memberInfo;
     this.multiple = other.multiple;
     this.additionalAttributesProvider = other.additionalAttributesProvider;
     this.baseType = other.baseType;
     this.uniquePartName = other.uniquePartName;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:15,代码来源:MessagePartDescription.cs

示例10: MessagePartDescription

 internal MessagePartDescription(MessagePartDescription other)
 {
     _name = other._name;
     _ns = other._ns;
     _index = other._index;
     _type = other._type;
     _serializationPosition = other._serializationPosition;
     _hasProtectionLevel = other._hasProtectionLevel;
     _protectionLevel = other._protectionLevel;
     _memberInfo = other._memberInfo;
     _multiple = other._multiple;
     _additionalAttributesProvider = other._additionalAttributesProvider;
     _baseType = other._baseType;
     _uniquePartName = other._uniquePartName;
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:15,代码来源:MessagePartDescription.cs

示例11: AddMessagePartDescription

 public static void AddMessagePartDescription(OperationDescription operation, bool isResponse, MessageDescription message, string[] argumentNames, Type[] argumentTypes)
 {
     string ns = operation.DeclaringContract.Namespace;
     for (int i = 0; i < argumentNames.Length; i++)
     {
         string name = argumentNames[i];
         MessagePartDescription item = new MessagePartDescription(NamingHelper.XmlName(name), ns) {
             Index = i,
             Type = argumentTypes[i]
         };
         message.Body.Parts.Add(item);
     }
     if (isResponse)
     {
         SetReturnValue(message, operation);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:MessageBuilder.cs

示例12: StreamFormatter

 private StreamFormatter(MessageDescription messageDescription, MessagePartDescription streamPart, string operationName, bool isRequest)
 {
     if (streamPart == messageDescription.Body.ReturnValue)
     {
         this.streamIndex = -1;
     }
     else
     {
         this.streamIndex = streamPart.Index;
     }
     this.wrapperName = messageDescription.Body.WrapperName;
     this.wrapperNS = messageDescription.Body.WrapperNamespace;
     this.partName = streamPart.Name;
     this.partNS = streamPart.Namespace;
     this.isRequest = isRequest;
     this.operationName = operationName;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:StreamFormatter.cs

示例13: PartInfo

 public PartInfo(MessagePartDescription description, XmlDictionaryString dictionaryName, XmlDictionaryString dictionaryNamespace, XmlDictionaryString itemName, XmlDictionaryString itemNamespace)
 {
     _dictionaryName = dictionaryName;
     _dictionaryNamespace = dictionaryNamespace;
     _itemName = itemName;
     _itemNamespace = itemNamespace;
     _description = description;
     if (description.Type.IsArray)
     {
         _isArray = true;
         _typeCode = description.Type.GetElementType().GetTypeCode();
     }
     else
     {
         _isArray = false;
         _typeCode = description.Type.GetTypeCode();
     }
 }
开发者ID:shijiaxing,项目名称:wcf,代码行数:18,代码来源:PrimitiveOperationFormatter.cs

示例14: SerializeBody

        private void SerializeBody(XmlDictionaryWriter writer, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, object returnValue, object[] parameters)
        {
            if (serializer == null)
            {
                return;
            }

            bool hasReturnValue = IsValidReturnValue(returnPart);
            object[] bodyParameters = new object[bodyParts.Count + (hasReturnValue ? 1 : 0)];
            int paramIndex = 0;

            if (hasReturnValue)
                bodyParameters[paramIndex++] = returnValue;

            for (int i = 0; i < bodyParts.Count; i++)
                bodyParameters[paramIndex++] = parameters[bodyParts[i].Index];

            serializer.Serialize(writer, bodyParameters, null);
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:19,代码来源:XmlSerializerOperationFormatter.cs

示例15: IsTypeSupported

        private static bool IsTypeSupported(MessagePartDescription bodyDescription)
        {
            Fx.Assert(bodyDescription != null, "");
            Type type = bodyDescription.Type;
            if (type == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(SR.SFxMessagePartDescriptionMissingType, bodyDescription.Name, bodyDescription.Namespace)));

            if (bodyDescription.Multiple)
                return false;

            if (type == typeof(void))
                return true;
            if (type.IsEnum())
                return false;
            switch (type.GetTypeCode())
            {
                case TypeCode.Boolean:
                case TypeCode.DateTime:
                case TypeCode.Decimal:
                case TypeCode.Double:
                case TypeCode.Int32:
                case TypeCode.Int64:
                case TypeCode.Single:
                case TypeCode.String:
                    return true;
                case TypeCode.Object:
                    if (type.IsArray && type.GetArrayRank() == 1 && IsArrayTypeSupported(type.GetElementType()))
                        return true;
                    break;
                default:
                    break;
            }
            return false;
        }
开发者ID:shijiaxing,项目名称:wcf,代码行数:34,代码来源:PrimitiveOperationFormatter.cs


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