DependencyResolverRegistrar.RegisterLazySingleton(Func) method¶
Defined in
Type: DependencyResolverRegistrar
Namespace: ReactiveUI
Assembly: ReactiveUI.Core.dll
Applies to
net10.0, net9.0, net8.0, net462, net481
Overloads¶
-
public void RegisterLazySingleton<TService>(Func<TService> factory) where TService : class -
public void RegisterLazySingleton<TService>(Func<TService> factory, string? contract) where TService : class
1. Overload¶
public void RegisterLazySingleton<TService>(Func<TService> factory) where TService : class
Inherited documentation
These docs were inherited from IRegistrar. The member doesn't override them on this type.
Summary: Registers a lazy singleton for a service type. The factory function is called the first time the service is resolved, and the same instance is returned for all subsequent resolutions.
Type parameters
| Name | Description |
|---|---|
TService | The service type to register. |
Parameters
| Name | Type | Description |
|---|---|---|
factory | Func | A factory function that creates the service instance. |
2. Overload¶
public void RegisterLazySingleton<TService>(Func<TService> factory, string? contract) where TService : class
Inherited documentation
These docs were inherited from IRegistrar. The member doesn't override them on this type.
Summary: Registers a lazy singleton for a service type. The factory function is called the first time the service is resolved, and the same instance is returned for all subsequent resolutions.
Type parameters
| Name | Description |
|---|---|
TService | The service type to register. |
Parameters
| Name | Type | Description |
|---|---|---|
factory | Func | A factory function that creates the service instance. |
contract | string? | An optional contract name for multiple registrations of the same type. |