/// <summary>Creates the specified type using the give <see cref="ContainerOptions"/> . Tries to resolve the needed dependencies.</summary> /// <typeparam name="T">The type of the object to create </typeparam> /// <param name="buildingOptions">The used options. </param> /// <returns>The created instance </returns> public T Create <T>(ContainerOptions buildingOptions) where T : class { return(Create(typeof(T), buildingOptions) as T); }
/// <summary>Creates the specified type using the give <see cref="ContainerOptions"/> . Tries to resolve the needed dependencies.</summary> /// <param name="type">The type to create. </param> /// <param name="containerOptions">The used options. </param> /// <returns>The created instance </returns> /// <exception cref="NotSupportedException"> /// <paramref name="type"/> cannot be a <see cref="T:System.Reflection.Emit.TypeBuilder"/>.-or- Creation of /// <see cref="T:System.TypedReference"/>, <see cref="T:System.ArgIterator"/>, <see cref="T:System.Void"/>, and <see cref="T:System.RuntimeArgumentHandle"/> types, or arrays of /// those types, is not supported. /// </exception> /// <exception cref="ArgumentException"> /// <paramref name="type"/> is not a RuntimeType. -or-<paramref name="type"/> is an open generic type (that is, the /// <see cref="P:System.Type.ContainsGenericParameters"/> property returns true). /// </exception> /// <exception cref="ArgumentNullException"><paramref name="type"/> is null. </exception> /// <exception cref="TargetInvocationException">The constructor being called throws an exception. </exception> /// <exception cref="TypeLoadException"><paramref name="type"/> is not a valid type. </exception> /// <exception cref="COMException"><paramref name="type"/> is a COM object but the class identifier used to obtain the type is invalid, or the identified class is not registered. </exception> /// <exception cref="MissingMethodException">No matching public constructor was found. </exception> /// <exception cref="InvalidComObjectException">The COM type was not obtained through Overload:System.Type.GetTypeFromProgID" or "Overload:System.Type.GetTypeFromCLSID". </exception> /// <exception cref="MemberAccessException">Cannot create an instance of an abstract class, or this member was invoked with a late-binding mechanism. </exception> /// <exception cref="MethodAccessException">The caller does not have permission to call this constructor. </exception> public object Create(Type type, ContainerOptions containerOptions) { return(BuildInstance(type, containerOptions.ConstructorSelectionStrategy)); }