static void OnComplete(object parameter) { SessionReceiveContextAsyncResult result = parameter as SessionReceiveContextAsyncResult; Transaction savedTransaction = Transaction.Current; Transaction.Current = result.completionTransaction; try { Exception completionException = null; try { result.receiveContext.OnComplete(result.timeoutHelper.RemainingTime()); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } completionException = e; } result.Complete(false, completionException); } finally { Transaction.Current = savedTransaction; } }
static void OnAbandon(object parameter) { SessionReceiveContextAsyncResult result = parameter as SessionReceiveContextAsyncResult; Exception completionException = null; try { result.receiveContext.OnAbandon(result.timeoutHelper.RemainingTime()); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } completionException = e; } result.Complete(false, completionException); }
protected override void OnEndComplete(IAsyncResult result) { SessionReceiveContextAsyncResult.End(result); }
protected override void OnEndAbandon(IAsyncResult result) { SessionReceiveContextAsyncResult.End(result); }
protected override IAsyncResult OnBeginComplete(TimeSpan timeout, AsyncCallback callback, object state) { return(SessionReceiveContextAsyncResult.CreateComplete(this, timeout, callback, state)); }