c# - DI - Assembly wide install based on generic interface does not register its implementations -
i trying register interfaces , implementations using castle windsor.
i have class called productriskstatuschecks
implements ichecks<iproductrisk>
iproductrisk
implements ivalidatedomainobject
i tried install these below -
public void install(iwindsorcontainer container, iconfigurationstore store) { container.register( classes.fromassemblynamed("openboxextrabusinesslogic") .basedon<ichecks<ivalidatedomainobject>>() .withserviceallinterfaces().lifestylesingleton()); }
but doesn't install productriskchecks
against ichecks<iproductrisk>
if explicit register below works fine
container.register(component.for<ichecks<iproductrisk>>().implementedby<productriskchecks>());
can here know why isn't first case registering checks class ?
thanks
your registration not work because of type mismatch (exactly alexei mentioned).
i'm not sure want achieve here if have multiple implementations of ichecks<>
each different generic parameter , want register them can go registration using open generics:
container.register(classes.fromassemblynamed("openboxextrabusinesslogic") .basedon(typeof(icheck<>)) .withserviceallinterfaces() .lifestylesingleton())
Comments
Post a Comment