ServiceRegistryExtensions Class
Namespace: Stride.CoreAssembly: Stride.Core.dll
public static class ServiceRegistryExtensions
Name | Description | |
---|---|---|
Methods | ||
GetSafeServiceAs<T>(IServiceRegistry) | Gets a service instance from a specified interface contract. |
|
GetServiceAs<T>(IServiceRegistry) | Gets a service instance from a specified interface contract. |
|
GetServiceLate<T>(IServiceRegistry, Action<T>) | Gets a service instance from a specified interface contract. |
Methods
GetSafeServiceAs<T>(IServiceRegistry)
Gets a service instance from a specified interface contract.
public static T GetSafeServiceAs<T>(this IServiceRegistry registry)
where T : class
Parameters
Type | Name | Description |
---|---|---|
IServiceRegistry | registry | The registry. |
Returns
Type | Description |
---|---|
T | An instance of the requested service registered to this registry. |
Type Parameters
Name | Description |
---|---|
T | Type of the interface contract of the service |
Exceptions
Type | Condition |
---|---|
ServiceNotFoundException | If the service was not found |
GetServiceAs<T>(IServiceRegistry)
Gets a service instance from a specified interface contract.
[Obsolete("Use the generic overload of IServiceRegistry.GetService instead")]
public static T GetServiceAs<T>(this IServiceRegistry registry)
where T : class
Parameters
Type | Name | Description |
---|---|---|
IServiceRegistry | registry | The registry. |
Returns
Type | Description |
---|---|
T | An instance of the requested service registered to this registry. |
Type Parameters
Name | Description |
---|---|
T | Type of the interface contract of the service |
GetServiceLate<T>(IServiceRegistry, Action<T>)
Gets a service instance from a specified interface contract.
public static void GetServiceLate<T>(this IServiceRegistry registry, Action<T> serviceReady)
where T : class
Parameters
Type | Name | Description |
---|---|---|
IServiceRegistry | registry | The registry. |
System.Action<T> | serviceReady | The service ready. |
Type Parameters
Name | Description |
---|---|
T | Type of the interface contract of the service |
Exceptions
Type | Condition |
---|---|
ServiceNotFoundException | If the service was not found |