您是否可以为自动注册的Castle组件添加依赖项?

时间:2010-09-03 13:11:07

标签: castle-windsor auto-registration

我通常使用StructureMap,但在目前的项目中我使用Castle Windsor(2.1)。我找到了一些自动注册类型和接口的代码:

_container.Register(AllTypes.Pick().FromAssembly(GetType().Assembly).WithService.FirstInterface());

但是我想在其中一种类型中添加字符串依赖项。没有像这样的惯例,我可以做到这一点:

var registration = Component.For() .ImplementedBy().DependsOn(new[] { Property.ForKey("someString").Eq("blahblah") }); _container.Register(registration);

我有什么办法可以用自动注册的类型做到这一点吗?

1 个答案:

答案 0 :(得分:0)

您使用ConfigureFor<>方法,可以在粒度级别上微调您的注册。

相关问题