blob: 1e847e47a7bb4ef11f98309266da2e07eeb944ee (
plain)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tango.Core.DI
{
/// <summary>
/// Represents the Tango IOC container interface.
/// </summary>
public interface ITangoIOC
{
/// <summary>
/// Registers the specified type.
/// </summary>
/// <typeparam name="T"></typeparam>
void Register<T>() where T : class;
/// <summary>
/// Registers the specified instance type and instance.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="instance">The instance.</param>
void Register<T>(T instance) where T : class;
/// <summary>
/// Registers the specified type.
/// </summary>
/// <param name="type">The type.</param>
void Register(Type type);
/// <summary>
/// Registers the specified type and implementation type.
/// </summary>
/// <param name="type">The type.</param>
/// <param name="implementation">The implementation.</param>
void Register(Type type, Type implementation);
/// <summary>
/// Registers the specified type and instance.
/// </summary>
/// <param name="type">The type.</param>
/// <param name="instance">The instance.</param>
void Register(Type type, Object instance);
/// <summary>
/// Registers this instance.
/// </summary>
/// <typeparam name="Type">The type of the type.</typeparam>
/// <typeparam name="Implementation">The type of the implementation.</typeparam>
void Register<Type, Implementation>() where Implementation : class, Type;
/// <summary>
/// Registers the specified type, implementation and implementation instance.
/// </summary>
/// <typeparam name="Type">The type of the type.</typeparam>
/// <typeparam name="Implementation">The type of the implementation.</typeparam>
/// <param name="instance">The instance.</param>
void Register<Type, Implementation>(Implementation instance) where Implementation : class, Type;
/// <summary>
/// Determines whether the specified type is registered.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns>
/// <c>true</c> if this instance is registered; otherwise, <c>false</c>.
/// </returns>
bool IsRegistered<T>();
/// <summary>
/// Determines whether the specified type is registered.
/// </summary>
/// <param name="type">The type.</param>
/// <returns>
/// <c>true</c> if the specified type is registered; otherwise, <c>false</c>.
/// </returns>
bool IsRegistered(Type type);
/// <summary>
/// Unregisters the specified type.
/// </summary>
/// <typeparam name="T"></typeparam>
void Unregister<T>();
/// <summary>
/// Unregisters the specified type.
/// </summary>
/// <param name="type">The type.</param>
void Unregister(Type type);
/// <summary>
/// Gets the instance of type T.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
T GetInstance<T>();
/// <summary>
/// Injects any dependencies to the target properties using the <see cref="TangoInjectAttribute"/>.
/// </summary>
/// <param name="target">The target.</param>
void Inject(Object target);
/// <summary>
/// Executes the specified action when type T is available. if already available action will be executed immediately.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="callback">The callback.</param>
/// <returns></returns>
void GetInstanceWhenAvailable<T>(Action<T> callback);
/// <summary>
/// Gets all instances by the specified base type.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
IEnumerable<T> GetAllInstancesByBase<T>();
/// <summary>
/// Gets all instances by the specified base type.
/// </summary>
/// <param name="baseType">Type of the base.</param>
/// <returns></returns>
IEnumerable<Object> GetAllInstancesByBase(Type baseType);
/// <summary>
/// Gets the instance by the specified type.
/// </summary>
/// <param name="type">The type.</param>
/// <returns></returns>
object GetInstance(Type type);
}
}
|