public void TestBuildInstanceCreatorInDynAssembly() { ValidateInstCreator <TestSimpleClass>(ObjectInstantiationHelper.BuildInstanceCreatorInDynAssembly(typeof(TestSimpleClass), null)); ValidateInstCreator <TestClassWithConstructor>(ObjectInstantiationHelper.BuildInstanceCreatorInDynAssembly(typeof(TestClassWithConstructor), null)); var v3 = ValidateInstCreator <TestClassWithMarkedConstructor>(ObjectInstantiationHelper.BuildInstanceCreatorInDynAssembly(typeof(TestClassWithMarkedConstructor), null)); Assert.AreEqual(10, v3.Val); }
/// <summary> /// Creates a PerCallInterfaceLifetime container that resolves an instance of the specified object type /// </summary> /// <param name="objType">The type of the object that will be held by the lifetime container</param> /// <param name="injection">Injection resolver that will be used to create an instance if required</param> /// <param name="extInfo">Extended information supplied by the user (can be null)</param> /// <returns>Created lifetime container for the specified object type</returns> public override LifetimeBase Create(Type objType, IInjectionResolver injection, object extInfo) { if (objType == null) { throw new ArgumentNullException(nameof(objType)); } if (injection == null) { throw new ArgumentNullException(nameof(injection)); } var creationObj = ObjectInstantiationHelper.BuildInstanceCreatorInDynAssembly(objType, extInfo); return(new PerCallInterfaceLifetime(objType, creationObj)); }
/// <summary> /// Creates a PerCallInterfaceLifetime container that resolves an instance of the specified object type /// </summary> /// <param name="objType">The type of the object that will be held by the lifetime container</param> /// <param name="injection">Injection resolver that will be used to create an instance if required</param> /// <param name="extInfo">Extended information supplied by the user (can be null)</param> /// <returns>Created lifetime container for the specified object type</returns> public override LifetimeBase Create(Type objType, IInjectionResolver injection, object extInfo) { var creationObj = ObjectInstantiationHelper.BuildInstanceCreatorInDynAssembly(objType, extInfo); return(new PerCallInterfaceLifetime(objType, creationObj)); }