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

C# Description.MessageDescription类代码示例

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

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



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


示例16: MessageDescription

 internal MessageDescription(MessageDescription other)
 {
     this.action = other.action;
     this.direction = other.direction;
     this.Items.Body = other.Items.Body.Clone();
     foreach (MessageHeaderDescription description in other.Items.Headers)
     {
         this.Items.Headers.Add(description.Clone() as MessageHeaderDescription);
     }
     foreach (MessagePropertyDescription description2 in other.Items.Properties)
     {
         this.Items.Properties.Add(description2.Clone() as MessagePropertyDescription);
     }
     this.MessageName = other.MessageName;
     this.MessageType = other.MessageType;
     this.XsdTypeName = other.XsdTypeName;
     this.hasProtectionLevel = other.hasProtectionLevel;
     this.ProtectionLevel = other.ProtectionLevel;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:19,代码来源:MessageDescription.cs


示例17: MessageDescription

 internal MessageDescription(MessageDescription other)
 {
     _action = other._action;
     _direction = other._direction;
     this.Items.Body = other.Items.Body.Clone();
     foreach (MessageHeaderDescription mhd in other.Items.Headers)
     {
         this.Items.Headers.Add(mhd.Clone() as MessageHeaderDescription);
     }
     foreach (MessagePropertyDescription mpd in other.Items.Properties)
     {
         this.Items.Properties.Add(mpd.Clone() as MessagePropertyDescription);
     }
     this.MessageName = other.MessageName;
     this.MessageType = other.MessageType;
     this.XsdTypeName = other.XsdTypeName;
     _hasProtectionLevel = other._hasProtectionLevel;
     this.ProtectionLevel = other.ProtectionLevel;
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:19,代码来源:MessageDescription.cs


示例18: GetMessageBindingAssertions

 public override PolicyAssertionCollection GetMessageBindingAssertions(MessageDescription message)
 {
     lock (this.messageBindingAssertions)
     {
         if (!this.messageBindingAssertions.ContainsKey(message))
         {
             this.messageBindingAssertions.Add(message, new PolicyAssertionCollection());
         }
     }
     return this.messageBindingAssertions[message];
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:MetadataExporter.cs


示例19: GetCopyOfOperationDescription

        private static OperationDescription GetCopyOfOperationDescription(OperationDescription other)
        {
            OperationDescription operationDecription = new OperationDescription(other.Name, other.DeclaringContract)
            {
                BeginMethod = other.BeginMethod,
                EndMethod = other.EndMethod,
                IsInitiating = other.IsInitiating,
                IsTerminating = other.IsTerminating,
                ProtectionLevel = other.ProtectionLevel,
                SyncMethod = other.SyncMethod,
            };

            // copy Behaviors, Known Types, Faults
            foreach (IOperationBehavior behavior in other.Behaviors)
            {
                operationDecription.Behaviors.Add(behavior);
            }

            foreach (Type knownType in other.KnownTypes)
            {
                operationDecription.KnownTypes.Add(knownType);
            }

            foreach (FaultDescription fault in other.Faults)
            {
                operationDecription.Faults.Add(fault);
            }

            // copy the Messages from the original OperationDescription
            foreach (MessageDescription messageDescription in other.Messages)
            {
                MessageDescription newMessageDescription = new MessageDescription(messageDescription.Action, messageDescription.Direction);
                operationDecription.Messages.Add(newMessageDescription);
            }

            return operationDecription;
        }
开发者ID:nuxleus,项目名称:WCFWeb,代码行数:37,代码来源:ClientContractDescriptionHelper.cs


示例20: CreateOutputBinding

		void CreateOutputBinding (ServiceEndpoint endpoint, OperationBinding op_binding,
		                          MessageDescription sm_md)
		{
			var out_binding = new OutputBinding ();
			op_binding.Output = out_binding;

			var message_version = endpoint.Binding.MessageVersion ?? MessageVersion.None;
			if (message_version == MessageVersion.None)
				return;

			SoapBodyBinding soap_body_binding;
			if (message_version.Envelope == EnvelopeVersion.Soap11) {
				soap_body_binding = new SoapBodyBinding ();
			} else if (message_version.Envelope == EnvelopeVersion.Soap12) {
				soap_body_binding = new Soap12BodyBinding ();
			} else {
				throw new InvalidOperationException ();
			}

			soap_body_binding.Use = SoapBindingUse.Literal;
			out_binding.Extensions.Add (soap_body_binding);
		}
开发者ID:petermdobson,项目名称:mono-1,代码行数:22,代码来源:WsdlExporter.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Description.MessagePartDescription类代码示例发布时间:2022-05-26
下一篇:
C# Description.ContractDescription类代码示例发布时间: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