I have an interface
public interface IResolver<T>
{
T Resolve();
}
I know this isn't the ideal (service locator is an anti-pattern and all), but in some cases it's still necessary (for example WCF service activation - I don't want to instantiate the channel until Resolve() is explicitly called...and in the case of BasicHTTP, the channel may need to be Resolve()'d multiple times, since the channel is closed after each Operation call). And having a factory injected beats having the container itself injected into a constructor, right?
I want any class that inherits IResolver to be registered as a Factory automatically when they are registered in the container. That is, I want to automatically call AsFactory on the ComponentRegistration before registration gets processed.
How might I accomplish this?
Thanks in advance.