Given the following interfaces:
public interface IFoo
// Marker only
public interface IFooHandler<T> where T: IFoo
void Handle(T foo);
I want to scan some assemblies for all classes that implement IFooHandler<T> and register them for the specific T they implement. Then, at some point in my application code, I want to resolve all IFooHandlers for whatever T I'm dealing with. This has
If I wasn't trying to auto-register all types, I could do this easily with:
What I need to do is to scan the assembly, get back types of NormalCatFooHandler, and SpecialCatFooHandler and then register them to hande IFooHandler<Cat>. Assuming I'm able to handle the scanning of assemblies, how would I do the registration?