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


C# MessageFault.GetReaderAtDetailContents方法代码示例

本文整理汇总了C#中MessageFault.GetReaderAtDetailContents方法的典型用法代码示例。如果您正苦于以下问题:C# MessageFault.GetReaderAtDetailContents方法的具体用法?C# MessageFault.GetReaderAtDetailContents怎么用?C# MessageFault.GetReaderAtDetailContents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MessageFault的用法示例。


在下文中一共展示了MessageFault.GetReaderAtDetailContents方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateFaultException

 protected override FaultException CreateFaultException(MessageFault messageFault, string action)
 {
     IList<XmlSerializerOperationBehavior.Reflector.XmlSerializerFaultContractInfo> xmlSerializerFaultContractInfos;
     if (action != null)
     {
         xmlSerializerFaultContractInfos = new List<XmlSerializerOperationBehavior.Reflector.XmlSerializerFaultContractInfo>();
         for (int j = 0; j < this.xmlSerializerFaultContractInfos.Count; j++)
         {
             if ((this.xmlSerializerFaultContractInfos[j].FaultContractInfo.Action == action) || (this.xmlSerializerFaultContractInfos[j].FaultContractInfo.Action == "*"))
             {
                 xmlSerializerFaultContractInfos.Add(this.xmlSerializerFaultContractInfos[j]);
             }
         }
     }
     else
     {
         xmlSerializerFaultContractInfos = this.xmlSerializerFaultContractInfos;
     }
     System.Type detailType = null;
     object detailObj = null;
     for (int i = 0; i < xmlSerializerFaultContractInfos.Count; i++)
     {
         XmlSerializerOperationBehavior.Reflector.XmlSerializerFaultContractInfo info = xmlSerializerFaultContractInfos[i];
         XmlDictionaryReader readerAtDetailContents = messageFault.GetReaderAtDetailContents();
         XmlObjectSerializer serializer = info.Serializer;
         if (serializer.IsStartObject(readerAtDetailContents))
         {
             detailType = info.FaultContractInfo.Detail;
             try
             {
                 detailObj = serializer.ReadObject(readerAtDetailContents);
                 FaultException exception = base.CreateFaultException(messageFault, action, detailObj, detailType, readerAtDetailContents);
                 if (exception != null)
                 {
                     return exception;
                 }
             }
             catch (SerializationException)
             {
             }
         }
     }
     return new FaultException(messageFault, action);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:44,代码来源:XmlSerializerFaultFormatter.cs

示例2: TryCreateFault12

        public static bool TryCreateFault12(ReliableMessagingVersion reliableMessagingVersion, Message message,
            MessageFault fault, out WsrmHeaderFault wsrmFault)
        {
            // All wsrm header faults must be sender or receiver faults.
            if (!fault.Code.IsSenderFault && !fault.Code.IsReceiverFault)
            {
                wsrmFault = null;
                return false;
            }

            if ((fault.Code.SubCode == null)
                || (fault.Code.SubCode.Namespace != WsrmIndex.GetNamespaceString(reliableMessagingVersion)) || !fault.HasDetail)
            {
                wsrmFault = null;
                return false;
            }

            string subcodeName = fault.Code.SubCode.Name;
            XmlDictionaryReader detailReader = fault.GetReaderAtDetailContents();
            wsrmFault = CreateWsrmHeaderFault(reliableMessagingVersion, fault.Code, subcodeName, fault.Reason,
                detailReader);

            return (wsrmFault != null);
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:24,代码来源:WsrmFault.cs

示例3: CreateFaultException

        protected override FaultException CreateFaultException(MessageFault messageFault, string action)
        {
            IList<XmlSerializerOperationBehavior.Reflector.XmlSerializerFaultContractInfo> faultInfos;
            if (action != null)
            {
                faultInfos = new List<XmlSerializerOperationBehavior.Reflector.XmlSerializerFaultContractInfo>();
                for (int i = 0; i < _xmlSerializerFaultContractInfos.Count; i++)
                {
                    if (_xmlSerializerFaultContractInfos[i].FaultContractInfo.Action == action
                        || _xmlSerializerFaultContractInfos[i].FaultContractInfo.Action == MessageHeaders.WildcardAction)
                    {
                        faultInfos.Add(_xmlSerializerFaultContractInfos[i]);
                    }
                }
            }
            else
            {
                faultInfos = _xmlSerializerFaultContractInfos;
            }

            Type detailType = null;
            object detailObj = null;
            for (int i = 0; i < faultInfos.Count; i++)
            {
                XmlSerializerOperationBehavior.Reflector.XmlSerializerFaultContractInfo faultInfo = faultInfos[i];
                XmlDictionaryReader detailReader = messageFault.GetReaderAtDetailContents();
                XmlObjectSerializer serializer = faultInfo.Serializer;

                if (serializer.IsStartObject(detailReader))
                {
                    detailType = faultInfo.FaultContractInfo.Detail;
                    try
                    {
                        detailObj = serializer.ReadObject(detailReader);
                        FaultException faultException = CreateFaultException(messageFault, action,
                            detailObj, detailType, detailReader);
                        if (faultException != null)
                            return faultException;
                    }
                    catch (SerializationException)
                    {
                    }
                }
            }
            return new FaultException(messageFault, action);
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:46,代码来源:XmlSerializerFaultFormatter.cs

示例4: TryCreateFault

        public static bool TryCreateFault(Message message, MessageFault fault, out MakeConnectionMessageFault wsmcFault)
        {
            // all WS-MakeConnection faults are receiver faults
            if (!fault.Code.IsReceiverFault)
            {
                wsmcFault = null;
                return false;
            }

            if ((fault.Code.SubCode == null)
                || (fault.Code.SubCode.Namespace != MakeConnectionConstants.Namespace))
            {
                wsmcFault = null;
                return false;
            }

            XmlDictionaryReader detailReader = null;
            string subcodeName = fault.Code.SubCode.Name;
            if (fault.HasDetail)
            {
                detailReader = fault.GetReaderAtDetailContents();
            }

            wsmcFault = CreateMakeConnectionFault(message, fault.Code, subcodeName, fault.Reason, detailReader);
            return (wsmcFault != null);
        }
开发者ID:tian1ll1,项目名称:WPF_Examples,代码行数:26,代码来源:MakeConnectionMessageFault.cs


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