-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathIGameContainer.cs
113 lines (94 loc) · 4.51 KB
/
IGameContainer.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
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
using System;
using System.Collections.Generic;
#if DLL
namespace Invert.IOC
#else
namespace uFrame.IOC
#endif
{
public interface IUFrameContainer
{
/// <summary>
/// Clears all type mappings and instances.
/// </summary>
void Clear();
/// <summary>
/// Injects registered types/mappings into an object
/// </summary>
/// <param name="obj"></param>
void Inject(object obj);
/// <summary>
/// Injects everything that is registered at once
/// </summary>
void InjectAll();
/// <summary>
/// Register a type mapping
/// </summary>
/// <typeparam name="TSource">The base type.</typeparam>
/// <typeparam name="TTarget">The concrete type</typeparam>
void Register<TSource, TTarget>(string name = null);
void RegisterRelation<TFor, TBase, TConcrete>();
/// <summary>
/// Register an instance of a type.
/// </summary>
/// <typeparam name="TBase"></typeparam>
/// <param name="default"></param>
/// <param name="injectNow"></param>
/// <returns></returns>
void RegisterInstance<TBase>(TBase @default, bool injectNow) where TBase : class;
/// <summary>
/// Register an instance of a type.
/// </summary>
/// <param name="type"></param>
/// <param name="default"></param>
/// <param name="injectNow"></param>
/// <returns></returns>
void RegisterInstance(Type type, object @default, bool injectNow);
/// <summary>
/// Register a named instance
/// </summary>
/// <param name="baseType">The type to register the instance for.</param>
/// <param name="name">The name for the instance to be resolved.</param>
/// <param name="instance">The instance that will be resolved be the name</param>
/// <param name="injectNow">Perform the injection immediately</param>
void RegisterInstance(Type baseType, object instance = null, string name = null, bool injectNow = true);
void RegisterInstance<TBase>(TBase instance, string name, bool injectNow = true) where TBase : class;
void RegisterInstance<TBase>(TBase instance) where TBase : class;
/// <summary>
/// If an instance of T exist then it will return that instance otherwise it will create a new one based off mappings.
/// </summary>
/// <typeparam name="T">The type of instance to resolve</typeparam>
/// <returns>The/An instance of 'instanceType'</returns>
T Resolve<T>(string name = null, bool requireInstance = false, params object[] args) where T : class;
TBase ResolveRelation<TBase>(Type tfor, params object[] arg);
TBase ResolveRelation<TFor, TBase>(params object[] arg);
/// <summary>
/// Resolves all instances of TType or subclasses of TType. Either named or not.
/// </summary>
/// <typeparam name="TType">The Type to resolve</typeparam>
/// <returns>List of objects.</returns>
IEnumerable<TType> ResolveAll<TType>();
//IEnumerable<object> ResolveAll(Type type);
void Register(Type source, Type target, string name = null);
/// <summary>
/// Resolves all instances of TType or subclasses of TType. Either named or not.
/// </summary>
/// <typeparam name="TType">The Type to resolve</typeparam>
/// <returns>List of objects.</returns>
IEnumerable<object> ResolveAll(Type type);
TypeMappingCollection Mappings { get; set; }
TypeInstanceCollection Instances { get; set; }
TypeRelationCollection RelationshipMappings { get; set; }
/// <summary>
/// If an instance of instanceType exist then it will return that instance otherwise it will create a new one based off mappings.
/// </summary>
/// <param name="baseType">The type of instance to resolve</param>
/// <param name="name">The type of instance to resolve</param>
/// <param name="requireInstance">If true will return null if an instance isn't registered.</param>
/// <returns>The/An instance of 'instanceType'</returns>
object Resolve(Type baseType, string name = null, bool requireInstance = false, params object[] constructorArgs);
object ResolveRelation(Type tfor, Type tbase, params object[] arg);
void RegisterRelation(Type tfor, Type tbase, Type tconcrete);
object CreateInstance(Type type, params object[] args);
}
}