Exemplo n.º 1
0
        public void Intercept(IInvocation invocation)
        {
            if (StudioXCrossCuttingConcerns.IsApplied(invocation.InvocationTarget, StudioXCrossCuttingConcerns.Auditing))
            {
                invocation.Proceed();
                return;
            }

            if (!auditingHelper.ShouldSaveAudit(invocation.MethodInvocationTarget))
            {
                invocation.Proceed();
                return;
            }

            var auditInfo = auditingHelper.CreateAuditInfo(invocation.MethodInvocationTarget, invocation.Arguments);

            if (AsyncHelper.IsAsyncMethod(invocation.Method))
            {
                PerformAsyncAuditing(invocation, auditInfo);
            }
            else
            {
                PerformSyncAuditing(invocation, auditInfo);
            }
        }
Exemplo n.º 2
0
        public void Intercept(IInvocation invocation)
        {
            if (StudioXCrossCuttingConcerns.IsApplied(invocation.InvocationTarget, StudioXCrossCuttingConcerns.Validation))
            {
                invocation.Proceed();
                return;
            }

            using (var validator = iocResolver.ResolveAsDisposable <MethodInvocationValidator>())
            {
                validator.Object.Initialize(invocation.MethodInvocationTarget, invocation.Arguments);
                validator.Object.Validate();
            }

            invocation.Proceed();
        }