unity-interception

Unity: Register two interfaces as one singleton with interception

怎甘沉沦 提交于 2019-12-04 06:25:41
I have a class that implements two interfaces, and I want to apply interception to the class's methods. I'm following the advice in Unity Register two interfaces as one singleton , but I'm surprised by the results. In a nutshell, it seems that my CallHandler is called twice. The shortest example I have is this: public interface I1 { void Method1(); } public interface I2 { void Method2(); } public class C : I1, I2 { [Log] public void Method1() {} public void Method2() {} } public class LogAttribute : HandlerAttribute { public override ICallHandler CreateHandler(IUnityContainer container) {