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

silverlight - Applying a style to ItemContainerStyle in C# -

c# - NullReferenceException in MySqlClient.NativeDriver -

php - Updating recent updates - Problem in procedure - Any other approach? -