/// <summary> /// Intercepts and performs timing logic /// </summary> /// <param name="invocation">current invocation site</param> /// <param name="attributes">transaction attributes</param> protected override void OnIntercepted(IInvocation invocation, TransactionScopeAttribute[] attributes) { invocation = Arguments.EnsureNotNull(invocation, nameof(invocation)); try { var esio = EnterpriseServicesInteropOption.None; using var ts = new TransactionScope(this.scopeOption, this.options, esio); invocation.Proceed(); var stopwatch = Stopwatch.StartNew(); ts.Complete(); var timeSpan = stopwatch.ElapsedMilliseconds; this.Logger.Debug("COMMIT:{0} Duration(ms):{1}", invocation.GetConcreteMethod(), timeSpan); } catch (Exception ex) { this.Logger.Error(ex, "ROLLBACK:{0} Message:{1}", invocation.GetMethodName(), ex.Message); throw; } }