c# - Register multiple components with multiple services in Castle Windsor -
i have services , interfaces them in 2 separated assemblies, 1 interfaces , implementations.
i'm trying register them using castle windsor. works using this:
container.register(component .for(iservice1) .implementedby(service1) .lifestyle.transient()); container.register(component .for(iservice2) .implementedby(service2) .lifestyle.transient());
the thing here is... possible register components @ once? without having register them 1 one. have seen possible register multiple interfaces simple component, o multiple implementations single interface, haven't seen if it's possible register multiple interfaces 1 assembly multiple implementations assembly.
i don't know if has relevance, interfaces have same base(iservice in case).
thanks lot.
what looking registering components conventions. declare implementations castle should consider, , services should associate implementations with.
container.register( // want concrete classes in assembly classes.fromthisassembly() // filter them keep ones in specific namespace .insamenamespaceas<rootcomponent>() // register thoses classes interfaces match classes names .withservice.defaultinterfaces() // setting lifestyles components in batch .lifestyletransient() );
there many other options convention-based registration, best way take longer @ linked page.
Comments
Post a Comment