Closed khellang closed 8 years ago
Actually, after doing this work myself and digging a bit deeper, I realized this won't work anyway, cause there's no way to know the actual type being requested in a factory function.
That means I can't get the generic arguments of the concrete service type being requested :disappointed:
I don't see a way this can be solved, without changing the signature of the factory delegate to include more information...
When working on decoration in Scrutor, I noticed that there's an exception being thrown if you try to register an open generic type using a factory function.
What's the reasoning behind this? Is it just an oversight?
They way I've implemented the decoration is by chaining together
ServiceDescriptor
s using a combination of factory functions andActivatorUtilities
, but by having this limitation in place, I can't register a factory function for open generics.It would be nice if this requirement was lifted :smile: