Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top