Kanda Foundation 0.2.0
Loading...
Searching...
No Matches
IServiceContainer Interface Reference

A collection of one or more Kanda services. More...

+ Inheritance diagram for IServiceContainer:

Public Member Functions

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>.
 
Get< T > ()
 Gets a service by type.
 
Task< T > GetAsync< T > (AsyncObjectResolutionOptions options=null)
 Gets a service by type.
 

Detailed Description

A collection of one or more Kanda services.

Member Function Documentation

◆ Get< T >()

T Get< T > ( )

Gets a service by type.

Template Parameters
TThe 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.

Implemented in ServiceContainer.

◆ GetAsync< T >()

Task< T > GetAsync< T > ( AsyncObjectResolutionOptions options = null)

Gets a service by type.

Template Parameters
TThe 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.

Implemented in ServiceContainer.

◆ Register< T >()

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
instanceThe service instance to register.
overwriteExistingIf true, this will override any previously registered instance for this type.
Template Parameters
TThe type of service to register.

Implemented in ServiceContainer.


The documentation for this interface was generated from the following file: