/// <summary> /// Register the type via the AssemblyQualifiedName. /// </summary> /// <typeparam name="P1">The type of the 1st parameter.</typeparam> /// <typeparam name="P2">The type of the 2cd parameter.</typeparam> /// <typeparam name="P3">The type of the 3rd parameter.</typeparam> /// <typeparam name="T">The result type - the interface</typeparam> /// <param name="key">The key often null.</param> /// <param name="fqnType">The AssemblyQualifiedName.</param> public void RegisterLateLoad <P1, P2, P3, T>(object key, string fqnType) { var lateLoad = this.GetParent(FuncstructorConstant.ParentNameLateLoad) ?? this; var itemState = new ItemStateLateLoad(key, fqnType); Func <P1, P2, P3, T> funcLateLoad = (delegate(P1 l1, P2 l2, P3 l3) { var lateInstance = this.GetParent(FuncstructorConstant.ParentNameLateInstance) ?? this; Func <P1, P2, P3, T> funcLateInstance = (delegate(P1 i1, P2 i2, P3 i3) { return((T)System.Activator.CreateInstance(itemState.GetClassType(), i1, i2, i3)); }); lateInstance.Register <P1, P2, P3, T>(key, funcLateInstance, false); return(this.Resolve <P1, P2, P3, T>(itemState.Key, l1, l2, l3)); }); itemState.Funcstructor = funcLateLoad; this.Register(typeof(T), key, new Type[] { typeof(P1), typeof(P2), typeof(P3) }, itemState, false); }
/// <summary> /// Register the type via the AssemblyQualifiedName. /// </summary> /// <typeparam name="T">The result type - the interface</typeparam> /// <param name="key">The key often null.</param> /// <param name="fqnType">The AssemblyQualifiedName.</param> public void RegisterLateLoad <T>(object key, string fqnType) { var lateLoad = this.GetParent(FuncstructorConstant.ParentNameLateLoad) ?? this; var itemState = new ItemStateLateLoad(key, fqnType); Func <T> funcLateLoad = (delegate() { var lateInstance = this.GetParent(FuncstructorConstant.ParentNameLateInstance) ?? this; Func <T> funcLateInstance = (delegate() { return((T)System.Activator.CreateInstance(itemState.GetClassType())); }); lateInstance.Register <T>(key, funcLateInstance, false); return(this.Resolve <T>(itemState.Key)); }); itemState.Funcstructor = funcLateLoad; this.Register(typeof(T), key, null, itemState, false); }