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<TransactionAttribute>())
.With<TransactionInterceptor>
With a class like:
public SomeClass
{
[TransactionAttribute]
public void SomeTransactedMethod()
{ /*do stuff */ }
}
Assuming that you are using Ninject.Extensions.Interception this should do the trick
Make sure that the method that should be intercepted is marked as virtual.
When
SomeTransactedMethod()
is called it should be intercepted.UPDATE
You could create a custom planning strategy.
This should now work.
Here is the code that I used for the same purpose
And
And code for TransactionAttribute