/// <summary>Creates all modules.</summary> /// <returns>True if all are initialized, false otherwise.</returns> public bool Build() { for (var curNode = modules.Last; curNode != null; curNode = curNode.Previous, modules.RemoveLast()) { var cur = curNode.Value; var obj = injector.GetModule(cur.TImplementation); if (obj != null) { injector.AddModule(cur.TService, obj); } else { if (!injector.TryCreate(cur.TImplementation, out obj)) { return(false); } injector.AddModule(cur.TService, obj); } } return(true); }
public void AddModule(Type type, object obj) => injector.AddModule(type, obj);
public static void AddModule <T>(this IInjector injector, T obj) where T : notnull { injector.AddModule(typeof(T), obj); }
public void AddDynamicObject(object obj) => dynamicObjects.AddModule(obj);
public static void AddModule <T>(this IInjector injector, T obj) { injector.AddModule(typeof(T), obj); }