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 IAsyncCommand StartCommandContext() { IAsyncCommand asyncCommand = this.command; if (asyncCommand != null) { asyncCommand.SetContextDataInTls(); if (asyncCommand.PerUserTracingEnabled) { AirSyncDiagnostics.SetThreadTracing(); } } return(asyncCommand); }