Interface IServiceRegistrationProvider
Provides facilities to register a service.
A service must implement an interface that resides outside of its implementing assembly. A service that implements
an interface in its own assembly will not be accessible by any consumer due to resolution rules. This is true even
for a service that only exposes a private API. In such case, it is advisable to expose an internal API, and use
System.
Namespace: Snowflake.Services
Assembly: Snowflake.Framework.Primitives.dll
Syntax
public interface IServiceRegistrationProvider
Methods
RegisterService<T>(T)
Registers a singleton service with the service container, in order to be accessible to other incoming
IComposables. IComposable modules are loaded in dependency order; until
all dependencies as specified using Import
A service must implement an interface that resides outside of its implementing assembly. A service that implements
an interface in its own assembly will not be accessible by any consumer due to resolution rules; this is true even
for a service that only exposes a private API. In such case, it is advisable to manually manage the lifetime of
your service, or expose an internal API, and use System.
Declaration
void RegisterService<T>(T serviceInstance)
where T : class
Parameters
Type | Name | Description |
---|---|---|
T | serviceInstance | The instance of the service to register. |
Type Parameters
Name | Description |
---|---|
T | The type of the service to register. |
Exceptions
Type | Condition |
---|---|
System. |
Thrown when a service of the same type was already registered. |
System. |
Thrown when a service and its implementing type reside in the same assembly. |