-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIContainerRegistry.cs
More file actions
86 lines (75 loc) · 3.13 KB
/
IContainerRegistry.cs
File metadata and controls
86 lines (75 loc) · 3.13 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Isle.IOC
{
public interface IContainerRegistry
{
/// <summary>
/// Adds a supported registration implementation for the container to configure the builder with.
/// </summary>
void AddRegistration(IContainerRegistration registration);
/// <summary>
/// Register the given type as a provided interface.
/// </summary>
void Register<T, I>(params IOC.Parameter[] parameters)
where T : class
where I : class;
/// <summary>
/// Register the given type as either of the provided interfaces.
/// </summary>
void Register<T, I1, I2>(params IOC.Parameter[] parameters)
where T : class
where I1 : class
where I2 : class;
/// <summary>
/// Register the given instance of an object as a Singleton under the provided interface.
/// </summary>
void RegisterSingleton<I>(I instance)
where I : class;
/// <summary>
/// Register the given instance of an object as a Singleton under the provided interface.
/// </summary>
void RegisterSingleton<T, I>(T instance)
where T : class
where I : class;
/// <summary>
/// Register the given instance of an object as a Singleton under the provided interface.
/// </summary>
void RegisterSingleton<T, I>(params IOC.Parameter[] parameters)
where T : class
where I : class;
/// <summary>
/// Register the given instance of an object as a Singleton under the provided interfaces.
/// </summary>
void RegisterSingleton<T, I1, I2>(params IOC.Parameter[] parameters)
where T : class
where I1 : class
where I2 : class;
/// <summary>
/// Register all types in the given set of assemblies excluding the provided list of types
/// and filtering the remaining types by a suffix filter.
/// </summary>
/// <remarks>
/// It is recommended to use a convention such as using suffixes like "Service" or "Repository"
/// for classes that are registered en-mass.
/// </remarks>
void RegisterInAssemblies(IEnumerable<Assembly> assemblies, IEnumerable<Type> excludeTypes, IEnumerable<string> suffixFilters);
void RegisterInAssembliesPerWebRequest(IEnumerable<Assembly> assemblies, IEnumerable<Type> excludeTypes, IEnumerable<string> suffixFilters);
/// <summary>
/// Attempts to resolve the provided interface type from the IOC container.
/// If the type cannot be resolved and exception is raised.
/// </summary>
I Resolve<I>()
where I : class;
/// <summary>
/// Attempts to resolve the provided interface type from the IOC container.
/// If the type cannot be resolved then the default value is returned.
/// </summary>
I TryResolve<I>(I defaultValue = default(I))
where I : class;
}
}