如何将Interceptor应用于目录中的程序集列表?

时间:2012-12-05 00:42:00

标签: castle-windsor ioc-container castle castle-dynamicproxy

例如Mark Seemann对此question的回答 是这样的: container.Register(AllTypes.FromAssemblyInDirectory(new AssemblyFilter(folderPath)));

这将注册给定目录中的所有程序集,包括我不感兴趣的第三方程序集。

我只想在目录中注册程序集列表,第二部分我不知道该怎么做,就是将拦截器应用于该列表中的程序集。

所以我想问我该怎么做?

1 个答案:

答案 0 :(得分:0)

我不确定这是否有效,但我在想这样的事情:

foreach (var referencedAssembly in referencedAssemblies)
            {
                base.BootStrapContainer.Register(
                    Classes.FromAssemblyNamed(referencedAssembly)
                           .IncludeNonPublicTypes()
                           .Pick()
                           .Configure(component => component.Interceptors<TracingAspect>()));

            }