【问题标题】:ExceptionHandling with Unity and VirtualMethodInterceptor使用 Unity 和 Virtual MethodInterceptor 处理异常
【发布时间】: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


【解决方案1】:

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

谢谢

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-16
    • 1970-01-01
    • 2022-01-18
    • 1970-01-01
    • 2012-10-30
    • 2011-09-05
    相关资源
    最近更新 更多