-
Notifications
You must be signed in to change notification settings - Fork 3
/
IServiceContainerRegistrar.cs
31 lines (29 loc) · 1.34 KB
/
IServiceContainerRegistrar.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System;
namespace Inversion.Process
{
/// <summary>
/// Represent the contract of creating or adding to a simple
/// service container
/// Represent the contract of a simple service from which
/// services may be obtained by name.
/// This interface focuses on the configuration of a
/// container.
/// </summary>
public interface IServiceContainerRegistrar : IServiceContainer
{
/// <summary>
/// Registers a singleton service by storing its instance.
/// </summary>
/// <typeparam name="T">The type of the service being registered.</typeparam>
/// <param name="name">The name of the service to register.</param>
/// <param name="service">The function returning an instance of the service for registration.</param>
void RegisterService<T>(string name, Func<IServiceContainer, T> service);
/// <summary>
/// Registers a non-singleton service by storing its constructor.
/// </summary>
/// <typeparam name="T">The type of the service being registered.</typeparam>
/// <param name="name">The name of the service to register.</param>
/// <param name="ctor">The function returning a constructor for registration.</param>
void RegisterServiceNonSingleton<T>(string name, Func<IServiceContainer, T> ctor);
}
}