IRegistrar.Register(Func) method¶
Defined in
Type: IRegistrar
Namespace: ReactiveUI
Assembly: ReactiveUI.Core.dll
Applies to
net10.0, net9.0, net8.0, net462, net481
Overloads¶
-
void Register<TService>(Func<TService> factory) where TService : class -
void Register<TService>(Func<TService> factory, string? contract) where TService : class
1. Overload¶
void Register<TService>(Func<TService> factory) where TService : class
Summary: Registers a factory for a service type. The factory function is called each time the service is resolved, creating a new instance.
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¶
void Register<TService>(Func<TService> factory, string? contract) where TService : class
Summary: Registers a factory for a service type. The factory function is called each time the service is resolved, creating a new instance.
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. |