Browse Source
Fix tenant resolve options DI to use IOptions
pull/23264/head
maliming
7 months ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
1 changed files with
3 additions and
2 deletions
-
framework/src/Volo.Abp.AspNetCore.MultiTenancy/Microsoft/AspNetCore/Builder/AbpAspNetCoreMultiTenancyApplicationBuilderExtensions.cs
|
|
|
@ -1,6 +1,7 @@ |
|
|
|
using System.Linq; |
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using Microsoft.Extensions.Options; |
|
|
|
using Volo.Abp.AspNetCore.MultiTenancy; |
|
|
|
using Volo.Abp.MultiTenancy; |
|
|
|
|
|
|
|
@ -12,8 +13,8 @@ public static class AbpAspNetCoreMultiTenancyApplicationBuilderExtensions |
|
|
|
|
|
|
|
public static IApplicationBuilder UseMultiTenancy(this IApplicationBuilder app) |
|
|
|
{ |
|
|
|
var multiTenancyOptions = app.ApplicationServices.GetRequiredService<AbpTenantResolveOptions>(); |
|
|
|
var hasCurrentUserTenantResolveContributor = multiTenancyOptions.TenantResolvers.Any(r => r is CurrentUserTenantResolveContributor); |
|
|
|
var multiTenancyOptions = app.ApplicationServices.GetRequiredService<IOptions<AbpTenantResolveOptions>>(); |
|
|
|
var hasCurrentUserTenantResolveContributor = multiTenancyOptions.Value.TenantResolvers.Any(r => r is CurrentUserTenantResolveContributor); |
|
|
|
if (hasCurrentUserTenantResolveContributor) |
|
|
|
{ |
|
|
|
var authenticationMiddlewareSet = app.Properties.TryGetValue(AuthenticationMiddlewareSetKey, out var value) && value is true; |
|
|
|
|