本文整理汇总了C#中System.Runtime.Remoting.Messaging.ReturnMessage.SetLogicalCallContext方法的典型用法代码示例。如果您正苦于以下问题:C# ReturnMessage.SetLogicalCallContext方法的具体用法?C# ReturnMessage.SetLogicalCallContext怎么用?C# ReturnMessage.SetLogicalCallContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Runtime.Remoting.Messaging.ReturnMessage
的用法示例。
在下文中一共展示了ReturnMessage.SetLogicalCallContext方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AsyncDispatchMessage
public static IMessageCtrl AsyncDispatchMessage(IMessage msg, IMessageSink replySink)
{
IMessageCtrl ctrl = null;
try
{
if (msg == null)
{
throw new ArgumentNullException("msg");
}
IncrementRemoteCalls();
if (!(msg is TransitionCall))
{
CheckDisconnectedOrCreateWellKnownObject(msg);
}
ctrl = GetCrossContextChannelSink().AsyncProcessMessage(msg, replySink);
}
catch (Exception exception)
{
if (replySink == null)
{
return ctrl;
}
try
{
IMethodCallMessage message = (IMethodCallMessage) msg;
ReturnMessage message2 = new ReturnMessage(exception, (IMethodCallMessage) msg);
if (msg != null)
{
message2.SetLogicalCallContext(message.LogicalCallContext);
}
replySink.SyncProcessMessage(message2);
}
catch (Exception)
{
}
}
return ctrl;
}
示例2: AsyncDispatchMessage
[System.Security.SecurityCritical] // auto-generated_required
public static IMessageCtrl AsyncDispatchMessage(IMessage msg, IMessageSink replySink)
{
IMessageCtrl ctrl = null;
try
{
if(null == msg)
{
throw new ArgumentNullException("msg");
}
// we must switch to the target context of the object and call the context chains etc...
// Currenly XContextChannel does exactly so. So this method is just a wrapper..
// Make sure that incoming calls are counted as a remote call. This way it
// makes more sense on a server.
IncrementRemoteCalls();
if (!(msg is TransitionCall))
{
// Check if the object has been disconnected or if it is
// a well known object then we have to create it lazily.
CheckDisconnectedOrCreateWellKnownObject(msg);
}
// <
ctrl = ChannelServices.GetCrossContextChannelSink().AsyncProcessMessage(msg, replySink);
}
catch(Exception e)
{
if(null != replySink)
{
try
{
IMethodCallMessage mcm = (IMethodCallMessage)msg;
ReturnMessage retMsg = new ReturnMessage(e, (IMethodCallMessage)msg);
if (msg!=null)
{
retMsg.SetLogicalCallContext(mcm.LogicalCallContext);
}
replySink.SyncProcessMessage(retMsg);
}
catch(Exception )
{
// Fatal exception... ignore
}
}
}
return ctrl;
} // AsyncDispatchMessage
示例3: SyncProcessMessage
//IMessage::SyncProcessMessage
public IMessage SyncProcessMessage(IMessage msg)
{
BCLDebug.Assert(
Thread.CurrentContext.InternalContextID == _targetCtxID,
"Transition message routed to wrong context");
try
{
LogicalCallContext oldcctx = Message.PropagateCallContextFromMessageToThread(msg);
if (_delegate != null)
{
_delegate();
}
else
{
// This is the cross appdomain case, so we need to construct
// the delegate and call on it.
CallBackHelper cb = new CallBackHelper(
_privateData,
true /*fromEE*/,
_targetDomainID);
CrossContextDelegate ctxDel = new CrossContextDelegate(cb.Func);
ctxDel();
}
Message.PropagateCallContextFromThreadToMessage(msg, oldcctx);
}
catch (Exception e)
{
ReturnMessage retMsg = new ReturnMessage(e, new ErrorMessage());
retMsg.SetLogicalCallContext(
(LogicalCallContext) msg.Properties[Message.CallContextKey]);
return retMsg;
}
return this;
}
示例4: AsyncDispatchMessage
public static IMessageCtrl AsyncDispatchMessage(IMessage msg, IMessageSink replySink)
{
IMessageCtrl ctrl = null;
try
{
if(null == msg)
{
throw new ArgumentNullException("msg");
}
IncrementRemoteCalls();
if (!(msg is TransitionCall))
{
// Check if the object has been disconnected or if it is
// a well known object then we have to create it lazily.
CheckDisconnectedOrCreateWellKnownObject(msg);
}
ctrl = ChannelServices.GetCrossContextChannelSink().AsyncProcessMessage(msg, replySink);
}
catch(Exception e)
{
if(null != replySink)
{
try
{
IMethodCallMessage mcm = (IMethodCallMessage)msg;
ReturnMessage retMsg = new ReturnMessage(e, (IMethodCallMessage)msg);
if (msg!=null)
{
retMsg.SetLogicalCallContext(mcm.LogicalCallContext);
}
replySink.SyncProcessMessage(retMsg);
}
catch(Exception )
{
// Fatal exception... ignore
}
}
}
return ctrl;
} // AsyncDispatchMessage
示例5: SyncProcessMessage
public IMessage SyncProcessMessage(IMessage msg)
{
try
{
LogicalCallContext oldcctx = Message.PropagateCallContextFromMessageToThread(msg);
if (this._delegate != null)
{
this._delegate();
}
else
{
CallBackHelper helper = new CallBackHelper(this._eeData, true, this._targetDomainID);
CrossContextDelegate delegate2 = new CrossContextDelegate(helper.Func);
delegate2();
}
Message.PropagateCallContextFromThreadToMessage(msg, oldcctx);
}
catch (Exception exception)
{
ReturnMessage message = new ReturnMessage(exception, new ErrorMessage());
message.SetLogicalCallContext((LogicalCallContext) msg.Properties[Message.CallContextKey]);
return message;
}
return this;
}