Exemplo n.º 1
0
        private void RunWithThreadContext(Action action)
        {
            bool          flag         = false;
            IAsyncCommand asyncCommand = this.command;

            if (asyncCommand != null)
            {
                asyncCommand.SetContextDataInTls();
                if (asyncCommand.PerUserTracingEnabled)
                {
                    AirSyncDiagnostics.SetThreadTracing();
                }
                flag = true;
            }
            try
            {
                action();
            }
            finally
            {
                if (flag)
                {
                    Command.ClearContextDataInTls();
                    if (asyncCommand.PerUserTracingEnabled)
                    {
                        AirSyncDiagnostics.ClearThreadTracing();
                    }
                }
            }
        }
Exemplo n.º 2
0
 private void EndCommandContext(IAsyncCommand cmd)
 {
     if (cmd != null)
     {
         Command.ClearContextDataInTls();
         if (cmd.PerUserTracingEnabled)
         {
             AirSyncDiagnostics.ClearThreadTracing();
         }
     }
 }