我正在尝试实施通过拦截器,无法弄清楚如何通过流畅的机制注册接口。
我看到一个
Component.For<ServicesInterceptor>().Interceptors
但不知道如何使用它。有人可以帮我吗?这个例子 https://stackoverflow.com/questions/1188957/castle-interceptors-with-fluent-interface看起来有点复杂。
您分两步完成:
container.Register(Component.For<MyInterceptor>());
- 您注册要拦截的组件。使用
Interceptors
在 Fluent API 上的方法中,您指定要使用哪个已注册的拦截器(通过键或类型)来拦截此组件:
container.Register(Component.For<IFoo>().ImplementedBy<Foo>()
.Interceptors<MyInterceptor>());
See 文档 http://docs.castleproject.org/Windsor.Registering-Interceptors-ProxyOptions.ashx更多细节。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)