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(); } } } }
private void EndCommandContext(IAsyncCommand cmd) { if (cmd != null) { Command.ClearContextDataInTls(); if (cmd.PerUserTracingEnabled) { AirSyncDiagnostics.ClearThreadTracing(); } } }