I have a base class of Repository<T>. In a particular project I have several implemetations of this base class. e.g.
PersonRepository : Repository<T>
EmployerRepository : Repository<T>
Right now, I am register each of these repositories in a StructureMap ServiceRegistry class. like this:
ForRequestedType<Repository<Person>>()
.TheDefaultIsConcreteType<PersonRepository>();
ForRequestedType<Repository<Employer>>()
.TheDefaultIsConcreteType<EmployerRepository>();
This sucks, because every time I add a repository, I have to remember to register it. It's one more step.
Is there a way that I could search the project/assembly where PersonRepository is located and register everything that inherits from Repository<T>?