Questions tagged [ninject-interception]

Ninject Interception is a Ninject Extension project which facilitates interception, a design pattern commonly used in Aspect Oriented Programming (AOP). It does this through the use of proxies, namely DynamicProxy implementations of either the Castle or Linfu variety. AOP can be used to reduce or eliminate repetitive lines of code for common cross-cutting concerns, such as logging and error-handling.

Ninject Interception is a Ninject Extension project which facilitates the use of interceptors, a design pattern commonly used in Aspect Oriented Programming (AOP). It does this through the use of proxies, namely DynamicProxy implementations of either the Castle or Linfu variety. AOP can be used to reduce or eliminate repetitive lines of code for common cross-cutting concerns, such as logging and error-handling.

60 questions
20
votes
2 answers

Can't get Ninject.Extensions.Interception working

I've been trying for ages to figure this our. when i try to bind my class with an interceptor i'm getting the following exception on the line Kernel.Bind().ToSelf().Intercept().With(); Error loading Ninject component…
Ryan Burnham
  • 2,619
  • 3
  • 27
  • 43
20
votes
2 answers

How to intercept all the ASP.NET WebApi controller action methods calls with Ninject interception for logging?

Our company has the need to log certain things each time one of our action methods of our ASP.NET WebApi controllers gets called. Since we use Ninject for the DI right now, we'd like to use it also for this purpose. This is what I have tried so…
Ray
  • 12,101
  • 27
  • 95
  • 137
14
votes
2 answers

Ninject Intercept any method with certain attribute?

How can I get Ninject.Extensions.Interception to basically let me bind a specific interceptor to any method that has an attribute... psudocode: Kernel.Intercept(context => context.Binding.HasAttribute()) …
somemvcperson
  • 1,263
  • 2
  • 18
  • 31
7
votes
1 answer

Ninject Method-level interception with params

I've noticed in the tutorials for interception that you can target a method and intercept it. I.e. Kernel.Bind().ToSelf(); Kernel.InterceptReplace(foo => foo.ThrowsAnError(), invocation => {} ); The documentation/tutorial does not cover…
5
votes
1 answer

How to set up an optional method interception with Ninject?

Suppose I have a class in which I want to sometimes* (but now always) intercept some (but not all) methods. The way I understand it, this can be done either with, say, InterceptAround() in my Ninject module (in the higher-level code), or with an…
chase
  • 1,623
  • 1
  • 16
  • 21
5
votes
1 answer

Making Ninject Interceptor's Intercept method an async method

I'm using Ninject Interceptor in order do some tasks before and after the actual method gets called but I need these operations to be asynchronous. I have take a look at the following article making-ninject-interceptors-work-with-async-methods and…
khorvat
  • 1,630
  • 2
  • 20
  • 31
5
votes
1 answer

how to use Ninject intercept using InterceptAttribute

I have a NinjectWebCommon as follow. I am unable to get the TimingInterceptor to trigger on the method that has "Timing" attribute set. It works fine if the intercetor is defined at the class level where all method call is going to be intercepted,…
Eatdoku
  • 6,569
  • 13
  • 63
  • 98
5
votes
1 answer

Making Ninject Interceptors work with async methods

I am starting to work with ninject interceptors to wrap some of my async code with various behaviors and am having some trouble getting everything working. Here is an interceptor I am working with: public class MyInterceptor : IInterceptor { …
captncraig
  • 22,118
  • 17
  • 108
  • 151
5
votes
1 answer

Interception with Ninject. Fails to load IProxyRequestFactory

I'm learning to use Ninject and Interceptor pattern. I have the following interceptor. public class MyInterceptor:IInterceptor { public void Intercept(IInvocation invocation) { Console.WriteLine("Pre Execute: " +…
5
votes
2 answers

Ninject Interception - breaking changes when porting to Ninject 3.0

I will describe my environment: I have Ninject + Ninject Interception Extension working to enable auto registration of interceptors for all methods, marked with a special attribute. It is a common AoP + attributes + DI container scenario. My problem…
Cortlendt
  • 2,190
  • 4
  • 29
  • 50
4
votes
1 answer

Ninject Interception dynamic proxy problems

I'm trying to set up interception to work with Ninject which we have been using as our dependency injection framework for a while. I have downloaded the interception extension from NuGet and tried it with both the Castle Dynamicproxy implementation…
4
votes
1 answer

Intercepting on an Interface

I am trying to make something like an IAuditable interface, which acts as a marker for Ninject to intercept calls to. Suppose I have the following: public interface IAuditable { } public interface IProcessor { void Process(object o); } public…
ldam
  • 4,412
  • 6
  • 45
  • 76
4
votes
1 answer

Can't get Ninject Interception to work with WCF

we're switching from UNITY to Ninject as our default service locator for WCF services. There's a beautiful NuGet package available for doing this and getting the standard resolution up-and-running is a breeze. However - I want to intercept the calls…
Jochen van Wylick
  • 5,303
  • 4
  • 42
  • 64
4
votes
1 answer

Ninject Interception: Service calling intercepted method not being intercepted when called within itself

I have a service class injected with Ninject 3.0. I have set it up so it's proxy is a class proxy rather than an interface proxy. The service has 2 methods, a first one returning broad result and a second one calling the first one and filtering…
fireOut
  • 39
  • 1
  • 2
3
votes
1 answer

Ninject Intercept all instances of class X

I am trying out various frameworks implementations for AOP and I am really liking Ninject, however there is one criteria I just cannot get working for the life of me. I am trying to get it to use an interceptor against all classes that are a…
1
2 3 4