aop - Intercept interface methods in Ninject Interception Extension -


i'm playing around ninject interception extension. ian davis's blog post indicates interception based on actual service type, rather interface. example, following code have no effect because ifoo interface:

kernel.interceptbefore<ifoo>(f => f.dosomething(),      => console.writeline("before")); 

and of course, next code piece work if foo.dosomething virtual:

kernel.interceptbefore<foo>(f => f.dosomething(),      => console.writeline("before")); 

this seems pretty glaring hole when comes aspect-oriented programming. i've been pretty conscientious programming interfaces use mocking frameworks mock our various services, vast majority of actual method implementations not virtual. if mocking framework can produce ifoo method ask for, seems ninject ought able to.

so guess question two-fold:

  1. is there reason ninject interception doesn't allow bind interface methods?
  2. is there easy way make ninject bind dynamic "wrapper" classes can let me perform interception actions on interface methods, , pass call through real implementation?

i did spiking on , seems possible behavior interception extension. planned 2.2 release in near future have little patient. defenately change planned add 2.4. spike far productive. current unit test running though. there lot of new ones need added feature. if can send patch won't give support , guaranties bug free @ moment.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -