本文整理匯總了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;
}