0
kicks
Register Repository Implementations Automatically with Windsor
It is common in a domain driven design project to want to register all the implementations of IRepository<> by convention. There may be interfaces that inherit from IRepository<> such as ICustomerRepository inheriting from IRepository<Customer>.
This article provides a Castle Facility that takes as its configuration parameters the base type of the repository (IRepository<>) and a group of assemblies to search. It registers implementations of the IRepository interfaces both for the generic type and for the more specific type.
You would therefore be able to, in our example, retrieve CustomerRepository (implementation of ICustomerRepository) by resolving IRepository<Customer> or ICustomerRepository.
If you practice DDD and are using Windsor as your Inversion of Control container, this may be useful to you. If you use a different inversion of control container, the approach could be adapted to your needs.