Interface IServiceRegistrar
- Namespace
- SkyrimForge.Hosting
- 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. The framework provides some services, such as ILog and IGameEvents, to each plugin, and registering one throws. 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 public constructor, whose parameters are services too.
void Add<T>() where T : class
Type Parameters
T
Exceptions
- ArgumentException
Tis 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
factoryFunc<T>
Type Parameters
T
Exceptions
- ArgumentNullException
factoryisnull.- ArgumentException
Tis registered already, or the framework provides it to each plugin.
Add<TService, TImplementation>()
Registers a service the framework constructs through the one public constructor of TImplementation,
whose parameters are services too.
void Add<TService, TImplementation>() where TService : class where TImplementation : class, TService
Type Parameters
TServiceTImplementation
Exceptions
- ArgumentException
TServiceis registered already, or the framework provides it to each plugin.