How do I tell Windsor to add an Interceptor to all components registered that implement IMustBeIntercepted

前端 未结 2 1959
感情败类
感情败类 2021-01-03 01:47

If I registered several components with Windsor.

IAnimal provides BigAnimal IPerson provides SmellyPerson IWhale provides BlueWhale

etc.. pretty standard com

2条回答
  •  囚心锁ツ
    2021-01-03 02:38

    Just wrote this baby:

        public static BasedOnDescriptor WithInterceptor(this BasedOnDescriptor reg, string interceptorComponentName) {
            return reg.Configure(x=> x.Configuration(
                    Child.ForName("interceptors").Eq(
                        Child.ForName("interceptor").Eq(
                            "${" + interceptorComponentName + "}"
                    ))));
        }
    

提交回复
热议问题