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


C# ReturnMessage.SetLogicalCallContext方法代码示例

本文整理汇总了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;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:38,代码来源:ChannelServices.cs

示例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 
开发者ID:wsky,项目名称:System.Runtime.Remoting,代码行数:53,代码来源:ChannelServices.cs

示例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;    
        }
开发者ID:ArildF,项目名称:masters,代码行数:38,代码来源:message.cs

示例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
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:46,代码来源:channelservices.cs

示例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;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:TransitionCall.cs


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