當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。