Class CoreRegistry
A container to store all available IInitializablePackage and IServiceComponent in the project.
Namespace: Unity.Services.Core.Internal
Syntax
public sealed class CoreRegistry
Properties
Instance
Get the only registry of this project.
Declaration
public static CoreRegistry Instance { get; }
Property Value
Type | Description |
---|---|
CoreRegistry |
Methods
GetServiceComponent<TComponent>()
Get the instance of the given IServiceComponent type.
Declaration
public TComponent GetServiceComponent<TComponent>()
where TComponent : IServiceComponent
Returns
Type | Description |
---|---|
TComponent | Return the instance of the given IServiceComponent type if it has been registered; throws an exception otherwise. |
Type Parameters
Name | Description |
---|---|
TComponent | The type of IServiceComponent to get. |
Exceptions
Type | Condition |
---|---|
KeyNotFoundException | Thrown if the requested type of |
RegisterPackage<TPackage>(TPackage)
Store the given package
in this registry.
Declaration
public CoreRegistration RegisterPackage<TPackage>([NotNull] TPackage package)
where TPackage : IInitializablePackage
Parameters
Type | Name | Description |
---|---|---|
TPackage | package | The service package instance to register. |
Returns
Type | Description |
---|---|
CoreRegistration | Return a handle to the registered |
Type Parameters
Name | Description |
---|---|
TPackage | The type of IInitializablePackage to register. |
RegisterServiceComponent<TComponent>(TComponent)
Store the given component
in this registry.
Declaration
public void RegisterServiceComponent<TComponent>([NotNull] TComponent component)
where TComponent : IServiceComponent
Parameters
Type | Name | Description |
---|---|---|
TComponent | component | The component instance to register. |
Type Parameters
Name | Description |
---|---|
TComponent | The type of IServiceComponent to register. |