Table of Contents

Interface IServiceRegistrar

Namespace
SkyrimForge
Assembly
SkyrimForge.dll

Registers services for dependency injection.

public interface IServiceRegistrar

Remarks

Each plugin has its own registrations, so a registered service is constructed once for each plugin that declares it. Registering a type twice throws, as does registering one the framework provides to each plugin, such as ILog or IGameEvents. Registering one the framework shares among plugins, such as IUtility, replaces it for that plugin and for the services constructed for that plugin. The services the framework shares are constructed with the original.

Methods

Add<T>()

Registers a service the framework constructs through the type's one constructor, whose parameters are services too.

void Add<T>() where T : class

Type Parameters

T

Exceptions

ArgumentException

T is registered already, or the framework provides it to each plugin.

Add<T>(Func<T>)

Registers a service that factory constructs.

void Add<T>(Func<T> factory) where T : class

Parameters

factory Func<T>

Type Parameters

T

Exceptions

ArgumentNullException

factory is null.

ArgumentException

T is registered already, or the framework provides it to each plugin.

Add<TService, TImplementation>()

Registers a service the framework constructs through the one constructor of TImplementation, whose parameters are services too.

void Add<TService, TImplementation>() where TService : class where TImplementation : class, TService

Type Parameters

TService
TImplementation

Exceptions

ArgumentException

TService is registered already, or the framework provides it to each plugin.