使用 Unity 和 VirtualMethodInterceptor 进行异常处理
我已经使用企业库配置器在应用程序中配置了异常处理(简单:为所有异常添加了新策略,添加了传递到日志块的处理程序。然后将其写入 Windows 事件系统)
但是,当我使用 VirtualMethodInterceptor 实例化对象时- 它不处理任何异常。当我切换到透明代理拦截器时 - 它起作用了。
我使用代码来创建这样的对象:
_container.RegisterType<T, TK>(
new ContainerControlledLifetimeManager(),
new InterceptionBehavior<PolicyInjectionBehavior>(),
new Interceptor<VirtualMethodInterceptor>())
有什么问题吗? TransparentProxyInterceptor速度慢,最好不要使用。
我使用 Unity 5.0
更新版。忘了说:我正在使用一个属性来指示应该处理的方法: [ExceptionCallHandler("策略")]
I've configurated exception handling in app using Enterprise Library Configurator (Simple: Added new policy for all exception, added handler which passes to Logging Block. Than it is written to Windows Event System)
However, when I'm instantiating my objects using VirtualMethodInterceptor - it doesn't handle any exception. When I switch to TransparentProxyInterceptor - it works.
I use code for creating object like that:
_container.RegisterType<T, TK>(
new ContainerControlledLifetimeManager(),
new InterceptionBehavior<PolicyInjectionBehavior>(),
new Interceptor<VirtualMethodInterceptor>())
What's the problem? TransparentProxyInterceptor is slow, and it is better not to use it.
I use Unity 5.0
Upd. Forgot to say: I'm using an attribute to indicate methods that should be handled:
[ExceptionCallHandler("Policy")]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想我发现了我的问题 - 错过了 VirtualMethodInterceptor 和 InterfaceInterceptor。
谢谢
I think I found my problem - missed VirtualMethodInterceptor and InterfaceInterceptor.
Thanks