Beispiel #1
0
        public override async Task InterceptAsync(IPlusMethodInvocation invocation)
        {
            if (!ShouldIntercept(invocation, out var auditLog, out var auditLogAction))
            {
                await invocation.ProceedAsync();

                return;
            }

            var stopwatch = Stopwatch.StartNew();

            try
            {
                await invocation.ProceedAsync();
            }
            catch (Exception ex)
            {
                auditLog.Exceptions.Add(ex);
                throw;
            }
            finally
            {
                stopwatch.Stop();
                auditLogAction.ExecutionDuration = Convert.ToInt32(stopwatch.Elapsed.TotalMilliseconds);
                auditLog.Actions.Add(auditLogAction);
            }
        }
        public override async Task InterceptAsync(IPlusMethodInvocation invocation)
        {
            if (PlusCrossCuttingConcerns.IsApplied(invocation.TargetObject, PlusCrossCuttingConcerns.FeatureChecking))
            {
                await invocation.ProceedAsync();

                return;
            }

            await CheckFeaturesAsync(invocation);

            await invocation.ProceedAsync();
        }
        public override async Task InterceptAsync(IPlusMethodInvocation invocation)
        {
            if (!UnitOfWorkHelper.IsUnitOfWorkMethod(invocation.Method, out var unitOfWorkAttribute))
            {
                await invocation.ProceedAsync();

                return;
            }

            using (var uow = _unitOfWorkManager.Begin(CreateOptions(invocation, unitOfWorkAttribute)))
            {
                await invocation.ProceedAsync();

                await uow.CompleteAsync();
            }
        }
        public override async Task InterceptAsync(IPlusMethodInvocation invocation)
        {
            await AuthorizeAsync(invocation);

            await invocation.ProceedAsync();
        }
Beispiel #5
0
 public override async Task InterceptAsync(IPlusMethodInvocation invocation)
 {
     Validate(invocation);
     await invocation.ProceedAsync();
 }