문제

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?

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top