Exemplo n.º 1
0
 /// <summary>
 /// Creates a standalone service scope that can be used to resolve local services and
 /// replaces <see cref="HttpContext.RequestServices"/> with it.
 /// </summary>
 /// <param name="tenant">The tenant name related to the service scope to get.</param>
 /// <remarks>
 /// Disposing the returned <see cref="IServiceScope"/> instance restores the previous state.
 /// </remarks>
 public static async Task <IServiceScope> GetScopeAsync(this IShellHost shellHost, string tenant)
 {
     return((await shellHost.GetScopeAndContextAsync(shellHost.GetSettings(tenant))).Scope);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a standalone service scope that can be used to resolve local services and
 /// replaces <see cref="HttpContext.RequestServices"/> with it.
 /// </summary>
 /// <param name="tenant">The tenant name related to the scope and the shell to get.</param>
 /// <remarks>
 /// Disposing the returned <see cref="IServiceScope"/> instance restores the previous state.
 /// </remarks>
 public static Task <(IServiceScope Scope, ShellContext ShellContext)> GetScopeAndContextAsync(this IShellHost shellHost, string tenant)
 {
     return(shellHost.GetScopeAndContextAsync(shellHost.GetSettings(tenant)));
 }
 /// <summary>
 /// Creates a standalone service scope that can be used to resolve local services.
 /// </summary>
 /// <param name="tenant">The tenant name related to the service scope to get.</param>
 public static Task <ShellScope> GetScopeAsync(this IShellHost shellHost, string tenant)
 {
     return(shellHost.GetScopeAsync(shellHost.GetSettings(tenant)));
 }