/// <summary> /// Retrieve an instance of the given type from the service provider. If one is not found then instantiate it directly. /// </summary> /// <param name="provider">The service provider</param> /// <param name="type">The type of the service</param> /// <returns>The resolved service or created instance</returns> public static object GetServiceOrCreateInstance(IServiceProvider provider, Type type) { return(InternalActivatorUtilities.GetServiceOrCreateInstance(provider, type)); }
/// <summary> /// Retrieve an instance of the given type from the service provider. If one is not found then instantiate it directly. /// </summary> /// <typeparam name="T">The type of the service</typeparam> /// <param name="provider">The service provider used to resolve dependencies</param> /// <returns>The resolved service or created instance</returns> public static T GetServiceOrCreateInstance <T>(IServiceProvider provider) { return(InternalActivatorUtilities.GetServiceOrCreateInstance <T>(provider)); }