Base solution for your next web application

Activities of "smcclure"

Hi,

Is there a way to disable antiforgery tokens for an individual service that is created by the dynamic WebApi feature? I was looking for something similar to the DisableAbpAntiForgeryTokenValidation attribute, but didn't see anything.

Thanks!

Question

Hi,

Is there an appropriate way for me to intercept IRepository methods? Here is my current attempt.

I register my interceptor class

IocManager.IocContainer.Register(Component
                    .For<IRepository<Customer>>()
                    .Interceptors(InterceptorReference.ForType<CustomerChangeInterceptor>()).Anywhere);

At the moment, the interceptor only forwards the call

public void Intercept(IInvocation invocation)
{
    invocation.Proceed();
}

I get the following error from the UnitOfWorkInterceptor

[NullReferenceException: Object reference not set to an instance of an object.]
 Abp.Domain.Uow.UnitOfWorkAttribute.GetUnitOfWorkAttributeOrNull(MemberInfo methodInfo) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkAttribute.cs:143
   Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:25
   Castle.DynamicProxy.AbstractInvocation.Proceed() +484
   VDS.RapIDAdmin.Customers.CustomerChangeInterceptor.Intercept(IInvocation invocation) in C:\My Documents\CardSmith\Visual Studio Projects\RapIDAdmin\VDS.RapIDAdmin.Core\Customers\CustomerChangeInterceptor.cs:42
   Castle.DynamicProxy.AbstractInvocation.Proceed() +484

The error source seems to be that invocation.MethodInvocationTarget is null in the current context, so this fails in aspnetboilerplate/src/Abp/Domain/Uow/UnitOfWorkInterceptor.cs (line 24)

var unitOfWorkAttr = UnitOfWorkAttribute.GetUnitOfWorkAttributeOrNull(invocation.MethodInvocationTarget);

Thanks, Scott

Showing 1 to 2 of 2 entries