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


C# Description.MessageDescription类代码示例

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


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

示例1: AddParameterOrder

 protected void AddParameterOrder(MessageDescription message)
 {
     if (this.operation != null)
     {
         Operation operation = this.contractContext.GetOperation(this.operation);
         if (operation != null)
         {
             if (operation.ParameterOrder == null)
             {
                 operation.ParameterOrder = new string[this.GetParameterCount()];
             }
             if (operation.ParameterOrder.Length != 0)
             {
                 foreach (MessagePartDescription description in message.Body.Parts)
                 {
                     ParameterInfo additionalAttributesProvider = description.AdditionalAttributesProvider as ParameterInfo;
                     if ((additionalAttributesProvider != null) && (additionalAttributesProvider.Position >= 0))
                     {
                         operation.ParameterOrder[additionalAttributesProvider.Position] = description.Name;
                     }
                 }
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:MessageContractExporter.cs

示例2: Create

 internal static StreamFormatter Create(MessageDescription messageDescription, string operationName, bool isRequest)
 {
     MessagePartDescription streamPart = ValidateAndGetStreamPart(messageDescription, isRequest, operationName);
     if (streamPart == null)
         return null;
     return new StreamFormatter(messageDescription, streamPart, operationName, isRequest);
 }
开发者ID:dmetzgar,项目名称:wcf,代码行数:7,代码来源:StreamFormatter.cs

示例3: AddHeadersToMessage

 protected override void AddHeadersToMessage(Message message, MessageDescription messageDescription, object[] parameters, bool isRequest)
 {
     MessageInfo info = isRequest ? this.requestMessageInfo : this.replyMessageInfo;
     PartInfo[] headerParts = info.HeaderParts;
     if ((headerParts != null) && (headerParts.Length != 0))
     {
         MessageHeaders headers = message.Headers;
         for (int i = 0; i < headerParts.Length; i++)
         {
             PartInfo headerPart = headerParts[i];
             MessageHeaderDescription description = (MessageHeaderDescription) headerPart.Description;
             object parameterValue = parameters[description.Index];
             if (description.Multiple)
             {
                 if (parameterValue != null)
                 {
                     bool isXmlElement = description.Type == typeof(XmlElement);
                     foreach (object obj3 in (IEnumerable) parameterValue)
                     {
                         this.AddMessageHeaderForParameter(headers, headerPart, message.Version, obj3, isXmlElement);
                     }
                 }
             }
             else
             {
                 this.AddMessageHeaderForParameter(headers, headerPart, message.Version, parameterValue, false);
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:30,代码来源:DataContractSerializerOperationFormatter.cs

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

示例5: MessageToParts

		protected override object [] MessageToParts (MessageDescription md, Message message)
		{
			if (message.IsEmpty)
				return null;
				
			XmlDictionaryReader r = message.GetReaderAtBodyContents ();
			return (object []) GetSerializer (md.Body).Deserialize (r);
		}
开发者ID:nickchal,项目名称:pash,代码行数:8,代码来源:XmlMessagesFormatter.cs

示例6: getExistingElement

 private static KeyValuePair<string, ComplexType> getExistingElement(XmlTypeExtractor schemaImporter, MessageDescription message)
 {
     Func<KeyValuePair<string, ComplexType>, bool> existingElementPredicate =
         _ => _.Key == message.Body.WrapperNamespace && _.Value.Name == message.Body.WrapperName;
     if (!schemaImporter.Elements.Any(existingElementPredicate))
     {
         throw new InvalidOperationException("Couldn't find the element definition");
     }
     var existingElement = schemaImporter.Elements.Single(existingElementPredicate);
     return existingElement;
 }
开发者ID:kmcgain,项目名称:WsdlGenerator,代码行数:11,代码来源:ServiceWriter.cs

示例7: IsUntypedMessage

 private static bool IsUntypedMessage(MessageDescription message)
 {
     if (message == null)
     {
         return false;
     }
     return ((((message.Body.ReturnValue != null) &&
         (message.Body.Parts.Count == 0)) &&
         (message.Body.ReturnValue.Type == typeof(Message))) ||
         (((message.Body.ReturnValue == null) && (message.Body.Parts.Count == 1)) &&
         (message.Body.Parts[0].Type == typeof(Message))));
 }
开发者ID:richet,项目名称:WcfRestContrib,代码行数:12,代码来源:WebHttpBehavior.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: HasStream

 private static bool HasStream(MessageDescription messageDescription)
 {
     if ((messageDescription.Body.ReturnValue != null) && (messageDescription.Body.ReturnValue.Type == typeof(Stream)))
     {
         return true;
     }
     foreach (MessagePartDescription description in messageDescription.Body.Parts)
     {
         if (description.Type == typeof(Stream))
         {
             return true;
         }
     }
     return false;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:StreamFormatter.cs

示例10: GetStreamPart

 private static MessagePartDescription GetStreamPart(MessageDescription messageDescription)
 {
     if (OperationFormatter.IsValidReturnValue(messageDescription.Body.ReturnValue))
     {
         if ((messageDescription.Body.Parts.Count == 0) && (messageDescription.Body.ReturnValue.Type == typeof(Stream)))
         {
             return messageDescription.Body.ReturnValue;
         }
     }
     else if ((messageDescription.Body.Parts.Count == 1) && (messageDescription.Body.Parts[0].Type == typeof(Stream)))
     {
         return messageDescription.Body.Parts[0];
     }
     return null;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:StreamFormatter.cs

示例11: AssertMessageAndBodyDescription

		public static void AssertMessageAndBodyDescription (
			string action, MessageDirection dir,
			Type messageType, string bodyWrapperName,
			string bodyWrapperNS, bool bodyHasReturn,
			MessageDescription md, string label)
		{
			Assert.AreEqual (action, md.Action, label + " Action");
			Assert.AreEqual (dir, md.Direction, label + " Direction");
			Assert.AreEqual (messageType, md.MessageType, label + " MessageType");
			Assert.AreEqual (bodyWrapperName, md.Body.WrapperName,
				label + " Body.WrapperName");
			Assert.AreEqual (bodyWrapperNS, md.Body.WrapperNamespace,
				label + " Body.WrapperNamespace");
			Assert.AreEqual (bodyHasReturn, md.Body.ReturnValue != null,
				label + "Body hasReturn");
		}
开发者ID:nickchal,项目名称:pash,代码行数:16,代码来源:ServiceAssert.cs

示例12: ShowMessageBody

 static void ShowMessageBody(MessageDescription message)
 {
     Console.WriteLine(message.Direction == MessageDirection.Input ?"请求消息:" : "回复消息:");
     MessageBodyDescription body = message.Body;
     Console.WriteLine("<tns:{0} xmlns:tns=\"{1}\">", body.WrapperName,body.WrapperNamespace);
     foreach (var part in body.Parts)
     {
         Console.WriteLine("\t<tns:{0}>...</tns:{0}>", part.Name);
     }
     if (null != body.ReturnValue)
     {
         Console.WriteLine("\t<tns:{0}>...</tns:{0}>",
             body.ReturnValue.Name);
     }
     Console.WriteLine("</tns:{0}>", body.WrapperName);
 }
开发者ID:huoxudong125,项目名称:WCF-Demo,代码行数:16,代码来源:Program.cs

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

示例14: CreatePreflightOperation

        private static OperationDescription CreatePreflightOperation(OperationDescription operation)
        {
            ContractDescription contract = operation.DeclaringContract;
            var preflightOperation = new OperationDescription(operation.Name + CorsConstants.PreflightSuffix, contract);
            var inputMessage = new MessageDescription(
                operation.Messages[0].Action + CorsConstants.PreflightSuffix, MessageDirection.Input);
            inputMessage.Body.Parts.Add(
                new MessagePartDescription("input", contract.Namespace) { Index = 0, Type = typeof(Message) });
            preflightOperation.Messages.Add(inputMessage);
            var outputMessage = new MessageDescription(
                operation.Messages[1].Action + CorsConstants.PreflightSuffix, MessageDirection.Output);
            outputMessage.Body.ReturnValue = new MessagePartDescription(
                preflightOperation.Name + "Return", contract.Namespace) { Type = typeof(Message) };
            preflightOperation.Messages.Add(outputMessage);

            return preflightOperation;
        }
开发者ID:BenderRodrigez,项目名称:CSharpViPNetCSP,代码行数:17,代码来源:CorsEnabledServiceHost.cs

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


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