سؤال

container.RegisterType<IMyType, MyType>("MyType");

container.AddNewExtension<Interception>()
            .Configure<Interception>()
            .SetInterceptorFor<IMyType>(new InterfaceInterceptor());

When I Resolve my Type with a name,the Interception doesn't work. But when I remove the name,it will works again. what's wrong with my code?

هل كانت مفيدة؟

المحلول

You did not specify which InterceptionBehavior you want to use. Setting up the interceptor does not add any behavior.

Have a look at the documentation on MSDN.

The section Unity 2.0 Approach contains a sample config.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top