Castle Windsor Registration of Interface and Abstract Implementations -
i trying work out how auto register implementations of generic abstract class or interface. here classes:
public abstract class abstractvalidator<t> : ivalidator<t> { public void validate(t) { ... } } public class customervalidator:abstractvalidator<customer> { ... }
i trying following:
_container = new windsorcontainer(); _container.register( alltypes.fromassemblycontaining<validationpatterns>() .basedon<ivalidator>() .withservice.base() })); ivalidator<customer> val = _container.resolve<ivalidator<customer>>();
any tips appreciated.
cheers
you're close. should basedon(typeof(ivalidator<>))
generic open type.
cheers.
Comments
Post a Comment