我通常使用 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);
有什么办法可以用自动注册的类型来做到这一点?