Can you add a dependency to a Castle component that was auto-registered?

88 views Asked by At

I generally use StructureMap, but on a current project I'm using Castle Windsor (2.1). I've found some code to auto-register types and interfaces:

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

However I would like to add a string dependency to one of the types. I can do this without the convention like this:

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

Is there any way I can do this with the auto-registered types?

1

There are 1 answers

0
Krzysztof Kozmic On BEST ANSWER

you use ConfigureFor<> method which lets you finetune your registration on a granular level.