-
-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Register services with ImplementationFactory #211
Comments
Hello @LeonxPRO! 👋🏻 The issue with providing a factory like that is that it needs to work for all subtypes of I'd love to know a bit more about what you're trying to do. Do you have a concrete example? |
Sample is pretty straighforward, just have a bunch of classes that have the same interface for wich you want to have a property filled during creation. .WithSingletonLifetime(Func<IServiceProvider, TService> implementationFactory)) would be awesome :) |
Any progress on this one? Basically it would be nice to get a callback for instance creation; (IServiceProvider, Type concreteType) |
We also would have loved to register a bunch of classes with an ImplementationFactory. The usecase for us is pretty straight forward: The classes are from a external library and do not really support DI as we need to call a method on each of the classes right after initialization. Find some sample code attached and how we use it currently:
Beeing able to simple search for all |
Hello!
First, thanks for a Scrutor)
Is it any way for register services with ImplementationFactory, like in native
IServiceCollection
method ?AddSingleton<TService>(Func<IServiceProvider, TService> implementationFactory)
I imagine that like:
instead
WithSingletonLifetime()
The text was updated successfully, but these errors were encountered: