コード例 #1
0
ファイル: ActivatorUtilities.cs プロジェクト: asimmon/Pillar
 /// <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));
 }
コード例 #2
0
ファイル: ActivatorUtilities.cs プロジェクト: asimmon/Pillar
 /// <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));
 }