Quick question – I can’t figure out the following:
I’ve written a Ninject module:
public void OnLoad(IKernel kernel)
{
kernel.Bind<GenericRepository>()
.ToConstructor(syntax => new GenericRepository(new DbContext()))
.Intercept()
.With<LogInterceptor>();
}
I’ve got an interceptor:
public void Intercept(IInvocation invocation)
{
invocation.proceed();
}
Application builds, module is loaded, the repository returns entities, however – If I put a breakpoint in the interceptor, it is never called.
Any ideas?
If I remember correctly, Ninject interception relies on Castle Proxy technology… so it can only work with virtual members.