【发布时间】:2011-09-21 11:31:53
【问题描述】:
我已经使用 Enterprise Library Configurator 在应用程序中配置了异常处理(简单:为所有异常添加了新策略,添加了传递给日志记录块的处理程序。而不是写入 Windows 事件系统)
但是,当我使用 VirtualMethodInterceptor 实例化我的对象时,它不会处理任何异常。当我切换到 TransparentProxyInterceptor - 它工作。
我使用代码来创建这样的对象:
_container.RegisterType<T, TK>(
new ContainerControlledLifetimeManager(),
new InterceptionBehavior<PolicyInjectionBehavior>(),
new Interceptor<VirtualMethodInterceptor>())
有什么问题? TransparentProxyInterceptor 很慢,最好不要用。
我使用 Unity 5.0
更新。忘了说:我使用一个属性来指示应该处理的方法: [ExceptionCallHandler("Policy")]
【问题讨论】:
-
嗨,这很难说 - 你能告诉我们关于行为的代码和失败的代码吗?
标签: c# exception-handling unity-container enterprise-library enterprise-library-5