Question

I want to inject some aspects in to methods/properties regardless whether it is private, public or protected.

I have gone through many blogs and forums and couldn't find a helpful article on this.

Can any one guide me on this ?

No correct solution

OTHER TIPS

There are limitations on how Unity intercept certain methods. Certainly it is a value-added feature on top of standard DI facilities provided by the framework. As far as I know, non of the Unity versions do not support AOP style interception on private methods, and constructors. TransparentProxyInterceptor would only intercept only the type's implemented interfaces or the type used by MarshalByRefObject And the VirtualMethodInterceptor would only intecept on virtual methods.

I don't think any new interceptors have been added to the Interception in v3. Also note that usual private/protected even internal methods require special intervention for AOP style interception. This is more less out of bound for Unity because it requires IL re-writing which usually handled by dedicated AOP framworks such as PostSharp.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top