ServiceFactory<T> typedef
ServiceFactory<T> =
T Function(IServiceProvider p)
Service factory.
T
is the service type.
Returns an instance of type T
, and the factory method receives an IServiceProvider as a parameter.
If the service is ServiceLifeTime.singleton, then IServiceProvider is the root service provider; If the service is ServiceLifeTime.scoped, then IServiceProvider is the service provider of the corresponding scope; If the service is ServiceLifeTime.transient, then IServiceProvider is the service provider of the corresponding scope;
Implementation
typedef ServiceFactory<T> = T Function(IServiceProvider p);