I want to use [HandlerAttribute]-based interception in my project (because it is slightly more obvious to the new developers). However I can't get it to work unless I explicitly specify new InterceptionBehavior<PolicyInjectionBehavior>() in RegisterType.
Is there an easy way to enable [HandlerAttribute] detection on everything without polluting RegisterType calls?
I think the following should achieve what you're after
Define a
UnityContainerExtensionlike so:Add this to the container:
Then for every registered type, this should configure
Interceptionto apply on virtual members. This should then pick up on any applied[HandlerAttribute]s.