You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello!
First, thanks for a Scrutor)
Is it any way for register services with ImplementationFactory, like in native IServiceCollectionmethod ? AddSingleton<TService>(Func<IServiceProvider, TService> implementationFactory)
I imagine that like:
The issue with providing a factory like that is that it needs to work for all subtypes of TService, so you it would also have to know the specific type that it's trying to register in the callback.
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 :)
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: