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
1
vote
1 answer

Intercept creation of instances in Ninject

I am looking to intercept the creation of instances that implement a certain interface, or have a certain attribute. I am able to do something similiar with the interception extension, but that only seems to do method and property interception.…
Eric Scherrer
  • 3,328
  • 1
  • 19
  • 34
1
vote
1 answer

See if Ninject Activation Context bound to Type

I am trying to selectively use interception on types using Ninject. If an implementation implements a specific interface I want to intercept it. How can I check a Ninject Activation Context to see if its target implements an interface? public…
Eric Scherrer
  • 3,328
  • 1
  • 19
  • 34
1
vote
1 answer

MethodInfo.GetMethodBody returns null

I have an IInvocation (from Ninject.Extensions.Interception) that has a .Request.Method that points to a method on a class that I created in my application (so, custom, not anything in core .NET code). When I call…
zimdanen
  • 5,508
  • 7
  • 44
  • 89
1
vote
2 answers

Invalid Operation Exception in Ninject: "Error loading Ninject component IAdviceRegistry "

I am using Ninject 3.2.0.0 with Ninject.Extension.Factory 3.2.0.0 in a webforms application. I am getting error reports of the following... Error loading Ninject component IAdviceRegistry No such component has been registered in the kernel's…
1
vote
1 answer

Ninject retrieve Custom Attributes on parameters inside interceptor

I am attempting to enumerate the parameters of a decorated method to retrieve the custom attributes applied to those parameters to determine a specific value. I have the following in my interceptor, which shows two different methods that I tried to…
Brandon
  • 830
  • 1
  • 15
  • 35
1
vote
1 answer

Why does Ninject.Extensions.Interception require members to be virtual?

Why does Ninject.Extensions.Interception require all methods and properties be virtual? I am guessing it overrides the members to provide the AOP functionality but couldn't this be implemented by calling methods before and after the method to…
Sam Leach
  • 12,746
  • 9
  • 45
  • 73
1
vote
1 answer

Ninject interception attribute with parameters passed to interceptor?

I have interception working currently (very simplistically) with the following code: (see question at bottom) My Interceptor: public interface IAuthorizationInterceptor : IInterceptor { } public class AuthorizationInterceptor :…
Brandon
  • 830
  • 1
  • 15
  • 35
1
vote
1 answer

Ninject Interceptor custom PlanningStrategy not working in Ninject 3

I have been using Ninject 2 for a period and have updated to Ninject 3 to better support SignalR and other frameworks. The code below used to work fine. public class AttributeDrivenPlanningStrategy : NinjectComponent,…
Grofit
  • 17,693
  • 24
  • 96
  • 176
1
vote
1 answer

Ninject Interceptor calling twice beforeinvoke and afterinvoke methods

I am developing an app in asp.net in which I am implementing the Ninject Interceptor in which I am binding/registering the service…
Billz
  • 1,067
  • 6
  • 25
  • 57
1
vote
1 answer

Interception doesn't work with WCF and Ninject 3.0

I have problem with Ninject 3.0 and interception WCF method. I'm using TaskService <%@ ServiceHost Language="C#" Debug="true" Service="Fasade.TaskService" Factory="Ninject.Extensions.Wcf.NinjectServiceHostFactory"%> and my configuration…
MJendza
  • 43
  • 1
  • 4
1
vote
1 answer

Proxy exposing multiple interfaces with Ninject.Extensions.Interception.Linfu

I'm using Ninject.Extensions.Interception (more specifically, InterceptAttribute) and Ninject.Extensions.Interception.Linfu proxying to implement a logging mechanism in my C# app, but I am facing some problems when a proxied class implements several…
peflorencio
  • 2,284
  • 2
  • 32
  • 40
0
votes
1 answer

Injecting specific EF DbContext dependent on WCF and MVC request parameters using Ninject

I have an MVC3 and a WCF REST service that are both hosted in Azure and are using SQL Azure with Entity Framework 4.1 as the ORM. I want to introduce a sharding scheme to increase the scalability of this setup. As Azure is a stateless hosting…
0
votes
1 answer

Adding reference to Ninject.Extensions.Interception.DynamicProxy causes Ambiguous Match Excpetion

I have Ninject configured to do DI in an ASP.NET MVC 3 application. This is working fine and it injects the proper classes in to my controllers. When I try and add Ninject.Extensions.Interception to work with my application I start getting an…
0
votes
1 answer

Using Ninject, how can I use property injection, Lazy<>, and interception without encountering errors in castle.core?

I created a simple program as a PoC for an old SharePoint On-Prem project that uses ASP.NET Webforms. In its pages, I have to use property injection, and for everything else, I can use constructor injection. I am also…
0
votes
1 answer

Need architectural solution - Ninject Interception only works on classes in the kernel

I am working in an asp.net mvc application that uses Ninject for DI. I have been attempting to implement Ninject Interception for logging, following this 2-part article.…