防止方法被拦截-castle
当我在注册组件时为其分配拦截器(基于接口)时,属于接口契约一部分的每个方法都会被拦截。有没有办法防止方法被属性或其他东西拦截?
谢谢
When I assign an interceptor to the component when registering it (interface based), every method that is part of the interface contract gets intercepted. Is there a way prevent a method from being intercepted an attribute or something?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
DP 使用
IProxyGenerationHook
s 来决定应该拦截哪个方法。您可以提出自己的属性类型并用它来装饰您的方法,并有一个根据属性进行相应操作的钩子。或者根本不使用属性并使用一些其他逻辑来决定是否拦截方法。由你决定。 DP不会在这里限制你。
DP uses
IProxyGenerationHook
s to decide which method should be intercepted.You can come up with your own attribute type and decorate your methods with it, and have a hook that will act accordingly based on the attribute. Or not use attributes at all and have some other logic to decide whether or not to intercept a method. It's up to you. DP won't constrain you here.