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

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -