0

我已经使用 Enterprise Library Configurator 在应用程序中配置了异常处理(简单:为所有异常添加了新策略,添加了传递给日志记录块的处理程序。比它写入 Windows 事件系统)

但是,当我使用 VirtualMethodInterceptor 实例化我的对象时,它不会处理任何异常。当我切换到 TransparentProxyInterceptor - 它工作。

我使用代码来创建这样的对象:

_container.RegisterType<T, TK>(
            new ContainerControlledLifetimeManager(),
            new InterceptionBehavior<PolicyInjectionBehavior>(), 
            new Interceptor<VirtualMethodInterceptor>())

有什么问题?TransparentProxyInterceptor 比较慢,最好不要用。

我使用 Unity 5.0

更新。忘了说:我使用一个属性来指示应该处理的方法:[ExceptionCallHandler("Policy")]

4

1 回答 1

1

我想我发现了我的问题 - 错过了 VirtualMethodInterceptor 和 InterfaceInterceptor。

谢谢

于 2011-09-21T12:48:38.483 回答