More...
|
| void | Register< T > (T instance, bool overwriteExisting=false) |
| | Registers an instance of a service by type. This service will be resolved like a singleton with Get<T> and GetAsync<T>.- Parameters
-
| instance | The service instance to register. |
| overwriteExisting | If true, this will override any previously registered instance for this type. |
- Template Parameters
-
| T | The type of service to register. |
|
| |
| T | Get< T > () |
| | Gets a service by type.- Template Parameters
-
| T | The type of service to get. |
- Returns
- An instance of the service.
- Exceptions
-
| ServiceResolutionException<T> | Thrown if no instances or factories have been registered for this type. |
|
| |
| async Task< T > | GetAsync< T > (AsyncObjectResolutionOptions options=null) |
| | Gets a service by type.- Template Parameters
-
| T | The type of service to get. |
- Returns
- An instance of the service.
- Exceptions
-
| ServiceResolutionException<T> | Thrown if no instances or factories have been registered for this type. |
|
| |
◆ Get< T >()
Gets a service by type.
- Template Parameters
-
| T | The type of service to get. |
- Returns
- An instance of the service.
- Exceptions
-
| ServiceResolutionException<T> | Thrown if no instances or factories have been registered for this type. |
Implements IServiceContainer.
◆ GetAsync< T >()
Gets a service by type.
- Template Parameters
-
| T | The type of service to get. |
- Returns
- An instance of the service.
- Exceptions
-
| ServiceResolutionException<T> | Thrown if no instances or factories have been registered for this type. |
Implements IServiceContainer.
◆ Register< T >()
| void Register< T > |
( |
T | instance, |
|
|
bool | overwriteExisting = false ) |
|
inline |
Registers an instance of a service by type. This service will be resolved like a singleton with Get<T> and GetAsync<T>.
- Parameters
-
| instance | The service instance to register. |
| overwriteExisting | If true, this will override any previously registered instance for this type. |
- Template Parameters
-
| T | The type of service to register. |
Implements IServiceContainer.
The documentation for this class was generated from the following file:
- Runtime/DependencyInversion/Services/ServiceContainer.cs