本文整理汇总了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);
}
示例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);
}
示例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);
}