【问题标题】:Castle Windsor Interceptors - Order?温莎城堡拦截器 - 订单?
【发布时间】:2013-04-01 08:16:23
【问题描述】:

我想让拦截器以特定的顺序执行,并以这种方式使用 InterceptorAttribute 将它们绑定到类:

[Interceptor(typeof(type1))]
[Interceptor(typeof(type2))]
[Interceptor(typeof(type3))]
public class SomeClass {}

但不幸的是,城堡似乎不是运行 type1 拦截器,然后是 type2 和 type3,而是以其他顺序运行它们。如何强制执行特定订单?有可能吗?

[更新]

我尝试了配置文件 - 它似乎工作,但我更喜欢一个属性,似乎更容易。

【问题讨论】:

  • 不要使用拦截,而是尝试应用装饰器。

标签: castle-windsor


【解决方案1】:

通过属性应用的拦截器是不确定的。

推荐的方式是use the registration API。

【讨论】:

  • 我猜你是对的,所以会标记为答案,但这有点令人失望...... :(
  • @Klotin 您可以使用自定义属性和IContributeComponentModelConstruction 实现使其适用于属性。
猜你喜欢
  • 2015-06-21
  • 1970-01-01
  • 1970-01-01
  • 2011-06-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-07-23
  • 1970-01-01
相关资源
最近更新 更多