Create `Volo.Abp.MultiTenancy.Abstractions` package.

Resolve #16557
pull/16584/head
maliming 2 years ago
parent d67e8a24d2
commit f033f0a6ce
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4

@ -439,6 +439,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Ldap.Abstractions"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Ddd.Domain.Shared", "src\Volo.Abp.Ddd.Domain.Shared\Volo.Abp.Ddd.Domain.Shared.csproj", "{0858571B-CE73-4AD6-BD06-EC9F0714D8E9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.MultiTenancy.Abstractions", "src\Volo.Abp.MultiTenancy.Abstractions\Volo.Abp.MultiTenancy.Abstractions.csproj", "{86F3684C-A0A5-4943-8CFA-AE79E8E3E315}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -1309,6 +1311,10 @@ Global
{0858571B-CE73-4AD6-BD06-EC9F0714D8E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0858571B-CE73-4AD6-BD06-EC9F0714D8E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0858571B-CE73-4AD6-BD06-EC9F0714D8E9}.Release|Any CPU.Build.0 = Release|Any CPU
{86F3684C-A0A5-4943-8CFA-AE79E8E3E315}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{86F3684C-A0A5-4943-8CFA-AE79E8E3E315}.Debug|Any CPU.Build.0 = Debug|Any CPU
{86F3684C-A0A5-4943-8CFA-AE79E8E3E315}.Release|Any CPU.ActiveCfg = Release|Any CPU
{86F3684C-A0A5-4943-8CFA-AE79E8E3E315}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -1530,6 +1536,7 @@ Global
{8764DFAF-D13D-449A-9A5E-5D7F0B2D7FEF} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{0F80E95C-41E6-4F23-94FF-FC9D0B8D5D71} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{0858571B-CE73-4AD6-BD06-EC9F0714D8E9} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{86F3684C-A0A5-4943-8CFA-AE79E8E3E315} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5}

@ -18,6 +18,7 @@
<ProjectReference Include="..\Volo.Abp.Timing\Volo.Abp.Timing.csproj" />
<ProjectReference Include="..\Volo.Abp.ObjectMapping\Volo.Abp.ObjectMapping.csproj" />
<ProjectReference Include="..\Volo.Abp.Security\Volo.Abp.Security.csproj" />
<ProjectReference Include="..\Volo.Abp.MultiTenancy.Abstractions\Volo.Abp.MultiTenancy.Abstractions.csproj" />
</ItemGroup>
<ItemGroup>

@ -4,6 +4,7 @@ using Volo.Abp.AspNetCore.Components.DependencyInjection;
using Volo.Abp.DynamicProxy;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Security;
using Volo.Abp.Timing;
@ -13,7 +14,8 @@ namespace Volo.Abp.AspNetCore.Components;
[DependsOn(
typeof(AbpObjectMappingModule),
typeof(AbpSecurityModule),
typeof(AbpTimingModule)
typeof(AbpTimingModule),
typeof(AbpMultiTenancyAbstractionsModule)
)]
public class AbpAspNetCoreComponentsModule : AbpModule
{

@ -10,6 +10,7 @@ using Volo.Abp.Authorization;
using Volo.Abp.ExceptionHandling;
using Volo.Abp.Http;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Security;
using Volo.Abp.Uow;
using Volo.Abp.Validation;
@ -25,6 +26,7 @@ namespace Volo.Abp.AspNetCore;
typeof(AbpHttpModule),
typeof(AbpAuthorizationModule),
typeof(AbpValidationModule),
typeof(AbpMultiTenancyModule),
typeof(AbpExceptionHandlingModule)
)]
public class AbpAspNetCoreModule : AbpModule

@ -4,7 +4,7 @@ using Volo.Abp.MultiTenancy;
namespace Volo.Abp.Authorization;
[DependsOn(
typeof(AbpMultiTenancyModule)
typeof(AbpMultiTenancyAbstractionsModule)
)]
public class AbpAuthorizationAbstractionsModule : AbpModule
{

@ -8,6 +8,7 @@ using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;
using Volo.Abp.Localization.ExceptionHandling;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Security;
using Volo.Abp.VirtualFileSystem;
@ -16,7 +17,8 @@ namespace Volo.Abp.Authorization;
[DependsOn(
typeof(AbpAuthorizationAbstractionsModule),
typeof(AbpSecurityModule),
typeof(AbpLocalizationModule)
typeof(AbpLocalizationModule),
typeof(AbpMultiTenancyModule)
)]
public class AbpAuthorizationModule : AbpModule
{

@ -16,6 +16,7 @@
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.Json\Volo.Abp.Json.csproj" />
<ProjectReference Include="..\Volo.Abp.MultiTenancy.Abstractions\Volo.Abp.MultiTenancy.Abstractions.csproj" />
</ItemGroup>
</Project>

@ -3,12 +3,14 @@ using System.Collections.Generic;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Json;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Reflection;
namespace Volo.Abp.BackgroundJobs;
[DependsOn(
typeof(AbpJsonModule)
typeof(AbpJsonModule),
typeof(AbpMultiTenancyAbstractionsModule)
)]
public class AbpBackgroundJobsAbstractionsModule : AbpModule
{

@ -19,6 +19,7 @@
<ProjectReference Include="..\Volo.Abp.BackgroundWorkers\Volo.Abp.BackgroundWorkers.csproj" />
<ProjectReference Include="..\Volo.Abp.DistributedLocking.Abstractions\Volo.Abp.DistributedLocking.Abstractions.csproj" />
<ProjectReference Include="..\Volo.Abp.Guids\Volo.Abp.Guids.csproj" />
<ProjectReference Include="..\Volo.Abp.MultiTenancy\Volo.Abp.MultiTenancy.csproj" />
<ProjectReference Include="..\Volo.Abp.Timing\Volo.Abp.Timing.csproj" />
</ItemGroup>

@ -6,6 +6,7 @@ using Volo.Abp.Data;
using Volo.Abp.DistributedLocking;
using Volo.Abp.Guids;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Threading;
using Volo.Abp.Timing;
@ -16,7 +17,8 @@ namespace Volo.Abp.BackgroundJobs;
typeof(AbpBackgroundWorkersModule),
typeof(AbpTimingModule),
typeof(AbpGuidsModule),
typeof(AbpDistributedLockingAbstractionsModule)
typeof(AbpDistributedLockingAbstractionsModule),
typeof(AbpMultiTenancyModule)
)]
public class AbpBackgroundJobsModule : AbpModule
{

@ -6,13 +6,15 @@ using Volo.Abp.Application;
using Volo.Abp.AspNetCore.Components.Web;
using Volo.Abp.Authorization;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.BlazoriseUI;
[DependsOn(
typeof(AbpAspNetCoreComponentsWebModule),
typeof(AbpDddApplicationContractsModule),
typeof(AbpAuthorizationModule)
typeof(AbpAuthorizationModule),
typeof(AbpMultiTenancyModule)
)]
public class AbpBlazoriseUIModule : AbpModule
{
@ -32,4 +34,4 @@ public class AbpBlazoriseUIModule : AbpModule
context.Services.Replace(ServiceDescriptor.Scoped<IComponentActivator, ComponentActivator>());
context.Services.AddSingleton(typeof(AbpBlazorMessageLocalizerHelper<>));
}
}
}

@ -22,6 +22,7 @@
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.Auditing.Contracts\Volo.Abp.Auditing.Contracts.csproj" />
<ProjectReference Include="..\Volo.Abp.Localization\Volo.Abp.Localization.csproj" />
<ProjectReference Include="..\Volo.Abp.Data\Volo.Abp.Data.csproj" />
</ItemGroup>
</Project>

@ -1,5 +1,6 @@
using Volo.Abp.Application.Localization.Resources.AbpDdd;
using Volo.Abp.Auditing;
using Volo.Abp.Data;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.VirtualFileSystem;
@ -8,7 +9,8 @@ namespace Volo.Abp.Application;
[DependsOn(
typeof(AbpLocalizationModule),
typeof(AbpAuditingContractsModule)
typeof(AbpAuditingContractsModule),
typeof(AbpDataModule)
)]
public class AbpDddApplicationContractsModule : AbpModule
{

@ -9,6 +9,7 @@ using Volo.Abp.GlobalFeatures;
using Volo.Abp.Http;
using Volo.Abp.Http.Modeling;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Security;
using Volo.Abp.Settings;
@ -26,6 +27,7 @@ namespace Volo.Abp.Application;
typeof(AbpAuthorizationModule),
typeof(AbpHttpAbstractionsModule),
typeof(AbpSettingsModule),
typeof(AbpMultiTenancyModule),
typeof(AbpFeaturesModule),
typeof(AbpGlobalFeaturesModule)
)]

@ -5,7 +5,7 @@ using Volo.Abp.MultiTenancy;
namespace Volo.Abp.Domain;
[DependsOn(
typeof(AbpMultiTenancyModule),
typeof(AbpMultiTenancyAbstractionsModule),
typeof(AbpEventBusAbstractionsModule)
)]
public class AbpDddDomainSharedModule : AbpModule

@ -7,6 +7,7 @@ using Volo.Abp.EventBus;
using Volo.Abp.ExceptionHandling;
using Volo.Abp.Guids;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.ObjectMapping;
using Volo.Abp.Specifications;
using Volo.Abp.Timing;
@ -17,6 +18,7 @@ namespace Volo.Abp.Domain;
typeof(AbpAuditingModule),
typeof(AbpDataModule),
typeof(AbpEventBusModule),
typeof(AbpMultiTenancyModule),
typeof(AbpGuidsModule),
typeof(AbpTimingModule),
typeof(AbpObjectMappingModule),

@ -11,6 +11,7 @@
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.Localization\Volo.Abp.Localization.csproj" />
<ProjectReference Include="..\Volo.Abp.Data\Volo.Abp.Data.csproj" />
</ItemGroup>
<ItemGroup>

@ -1,4 +1,5 @@
using Volo.Abp.ExceptionHandling.Localization;
using Volo.Abp.Data;
using Volo.Abp.ExceptionHandling.Localization;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.VirtualFileSystem;
@ -11,7 +12,8 @@ namespace Volo.Abp.ExceptionHandling;
* We will re-design this package in a later time, probably with v5.0.
*/
[DependsOn(
typeof(AbpLocalizationModule)
typeof(AbpLocalizationModule),
typeof(AbpDataModule)
)]
public class AbpExceptionHandlingModule : AbpModule
{

@ -17,6 +17,7 @@
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.Json.Abstractions\Volo.Abp.Json.Abstractions.csproj" />
<ProjectReference Include="..\Volo.Abp.Timing\Volo.Abp.Timing.csproj" />
<ProjectReference Include="..\Volo.Abp.Data\Volo.Abp.Data.csproj" />
<PackageReference Include="System.Text.Json" Version="$(MicrosoftAspNetCorePackageVersion)" />
</ItemGroup>

@ -2,6 +2,7 @@
using System.Text.Encodings.Web;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Volo.Abp.Data;
using Volo.Abp.Json.SystemTextJson.JsonConverters;
using Volo.Abp.Json.SystemTextJson.Modifiers;
using Volo.Abp.Modularity;
@ -9,7 +10,7 @@ using Volo.Abp.Timing;
namespace Volo.Abp.Json.SystemTextJson;
[DependsOn(typeof(AbpJsonAbstractionsModule), typeof(AbpTimingModule))]
[DependsOn(typeof(AbpJsonAbstractionsModule), typeof(AbpTimingModule), typeof(AbpDataModule))]
public class AbpJsonSystemTextJsonModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks>
<AssemblyName>Volo.Abp.MultiTenancy.Abstractions</AssemblyName>
<PackageId>Volo.Abp.MultiTenancy.Abstractions</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.VirtualFileSystem\Volo.Abp.VirtualFileSystem.csproj" />
<ProjectReference Include="..\Volo.Abp.Localization\Volo.Abp.Localization.csproj" />
<ProjectReference Include="..\Volo.Abp.Data\Volo.Abp.Data.csproj" />
</ItemGroup>
<ItemGroup>
<Content Remove="Volo\Abp\MultiTenancy\Localization\*.json" />
<EmbeddedResource Include="Volo\Abp\MultiTenancy\Localization\*.json" />
</ItemGroup>
</Project>

@ -0,0 +1,28 @@
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy.Localization;
using Volo.Abp.VirtualFileSystem;
namespace Volo.Abp.MultiTenancy;
[DependsOn(
typeof(AbpVirtualFileSystemModule),
typeof(AbpLocalizationModule)
)]
public class AbpMultiTenancyAbstractionsModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<AbpMultiTenancyAbstractionsModule>();
});
Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Add<AbpMultiTenancyResource>("en")
.AddVirtualJson("/Volo/Abp/MultiTenancy/Localization");
});
}
}

@ -10,9 +10,6 @@ public class AbpTenantResolveOptions
public AbpTenantResolveOptions()
{
TenantResolvers = new List<ITenantResolveContributor>
{
new CurrentUserTenantResolveContributor()
};
TenantResolvers = new List<ITenantResolveContributor>();
}
}

@ -1,4 +1,6 @@
namespace Volo.Abp.MultiTenancy.ConfigurationStore;
using System;
namespace Volo.Abp.MultiTenancy.ConfigurationStore;
public class AbpDefaultTenantStoreOptions
{
@ -6,6 +8,6 @@ public class AbpDefaultTenantStoreOptions
public AbpDefaultTenantStoreOptions()
{
Tenants = new TenantConfiguration[0];
Tenants = Array.Empty<TenantConfiguration>();
}
}

@ -0,0 +1,9 @@
using Volo.Abp.Localization;
namespace Volo.Abp.MultiTenancy.Localization;
[LocalizationResourceName("AbpMultiTenancy")]
public class AbpMultiTenancyResource
{
}

@ -0,0 +1,9 @@
{
"culture": "en-GB",
"texts": {
"TenantNotFoundMessage": "Tenant not found!",
"TenantNotFoundDetails": "There is no tenant with the tenant id or name: {0}",
"TenantNotActiveMessage": "Tenant is not active!",
"TenantNotActiveDetails": "The tenant is not active with the tenant id or name: {0}"
}
}

@ -0,0 +1,9 @@
{
"culture": "en",
"texts": {
"TenantNotFoundMessage": "Tenant not found!",
"TenantNotFoundDetails": "There is no tenant with the tenant id or name: {0}",
"TenantNotActiveMessage": "Tenant is not active!",
"TenantNotActiveDetails": "The tenant is not active with the tenant id or name: {0}"
}
}

@ -0,0 +1,9 @@
{
"culture": "tr",
"texts": {
"TenantNotFoundMessage": "Kiracı bulunamadı!",
"TenantNotFoundDetails": "Kiracı kimliğine veya adına sahip bir kiracı yok: {0}",
"TenantNotActiveMessage": "Kiracı aktif değil!",
"TenantNotActiveDetails": "Kiracı, kiracı kimliği veya adıyla etkin değil: {0}"
}
}

@ -0,0 +1,9 @@
{
"culture": "zh-Hans",
"texts": {
"TenantNotFoundMessage": "找不到租户!",
"TenantNotFoundDetails": "无法找到ID或名称为{0}的租户",
"TenantNotActiveMessage": "租户未启用!",
"TenantNotActiveDetails": "ID或名称为{0}的租户未启用"
}
}

@ -0,0 +1,9 @@
{
"culture": "zh-Hant",
"texts": {
"TenantNotFoundMessage": "找不到租戶!",
"TenantNotFoundDetails": "無法找到ID或名稱為{0}的租戶",
"TenantNotActiveMessage": "租戶未啟用!",
"TenantNotActiveDetails": "ID或名稱為{0}的租戶未啟用"
}
}

@ -0,0 +1,22 @@
using System;
namespace Volo.Abp.MultiTenancy;
public class TenantResolveContext : ITenantResolveContext
{
public IServiceProvider ServiceProvider { get; }
public string TenantIdOrName { get; set; }
public bool Handled { get; set; }
public bool HasResolvedTenantOrHost()
{
return Handled || TenantIdOrName != null;
}
public TenantResolveContext(IServiceProvider serviceProvider)
{
ServiceProvider = serviceProvider;
}
}

@ -17,7 +17,11 @@
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.Data\Volo.Abp.Data.csproj" />
<ProjectReference Include="..\Volo.Abp.EventBus.Abstractions\Volo.Abp.EventBus.Abstractions.csproj" />
<ProjectReference Include="..\Volo.Abp.MultiTenancy.Abstractions\Volo.Abp.MultiTenancy.Abstractions.csproj" />
<ProjectReference Include="..\Volo.Abp.Security\Volo.Abp.Security.csproj" />
<ProjectReference Include="..\Volo.Abp.Localization\Volo.Abp.Localization.csproj" />
<ProjectReference Include="..\Volo.Abp.Settings\Volo.Abp.Settings.csproj" />
<ProjectReference Include="..\Volo.Abp.VirtualFileSystem\Volo.Abp.VirtualFileSystem.csproj" />
</ItemGroup>
</Project>

@ -1,18 +1,19 @@
using Microsoft.Extensions.DependencyInjection;
using System.Collections.Generic;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Data;
using Volo.Abp.EventBus.Abstractions;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy.ConfigurationStore;
using Volo.Abp.Security;
using Volo.Abp.Settings;
namespace Volo.Abp.MultiTenancy;
//TODO: Create a Volo.Abp.MultiTenancy.Abstractions package?
[DependsOn(
typeof(AbpDataModule),
typeof(AbpSecurityModule),
typeof(AbpEventBusAbstractionsModule)
typeof(AbpEventBusAbstractionsModule),
typeof(AbpMultiTenancyAbstractionsModule)
)]
public class AbpMultiTenancyModule : AbpModule
{
@ -22,5 +23,15 @@ public class AbpMultiTenancyModule : AbpModule
var configuration = context.Services.GetConfiguration();
Configure<AbpDefaultTenantStoreOptions>(configuration);
Configure<AbpSettingOptions>(options =>
{
options.ValueProviders.InsertAfter(t => t == typeof(GlobalSettingValueProvider), typeof(TenantSettingValueProvider));
});
Configure<AbpTenantResolveOptions>(options =>
{
options.TenantResolvers.Add(new CurrentUserTenantResolveContributor());
});
}
}

@ -1,6 +1,8 @@
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Localization;
using Volo.Abp.DependencyInjection;
using Volo.Abp.MultiTenancy.Localization;
namespace Volo.Abp.MultiTenancy;
@ -9,15 +11,18 @@ public class TenantConfigurationProvider : ITenantConfigurationProvider, ITransi
protected virtual ITenantResolver TenantResolver { get; }
protected virtual ITenantStore TenantStore { get; }
protected virtual ITenantResolveResultAccessor TenantResolveResultAccessor { get; }
protected virtual IStringLocalizer<AbpMultiTenancyResource> StringLocalizer { get; }
public TenantConfigurationProvider(
ITenantResolver tenantResolver,
ITenantStore tenantStore,
ITenantResolveResultAccessor tenantResolveResultAccessor)
ITenantResolveResultAccessor tenantResolveResultAccessor,
IStringLocalizer<AbpMultiTenancyResource> stringLocalizer)
{
TenantResolver = tenantResolver;
TenantStore = tenantStore;
TenantResolveResultAccessor = tenantResolveResultAccessor;
StringLocalizer = stringLocalizer;
}
public virtual async Task<TenantConfiguration> GetAsync(bool saveResolveResult = false)
@ -38,8 +43,8 @@ public class TenantConfigurationProvider : ITenantConfigurationProvider, ITransi
{
throw new BusinessException(
code: "Volo.AbpIo.MultiTenancy:010001",
message: "Tenant not found!",
details: "There is no tenant with the tenant id or name: " + resolveResult.TenantIdOrName
message: StringLocalizer["TenantNotFoundMessage"],
details: StringLocalizer["TenantNotFoundDetails", resolveResult.TenantIdOrName]
);
}
@ -47,8 +52,8 @@ public class TenantConfigurationProvider : ITenantConfigurationProvider, ITransi
{
throw new BusinessException(
code: "Volo.AbpIo.MultiTenancy:010002",
message: "Tenant not active!",
details: "The tenant is no active with the tenant id or name: " + resolveResult.TenantIdOrName
message: StringLocalizer["TenantNotActiveMessage"],
details: StringLocalizer["TenantNotActiveDetails", resolveResult.TenantIdOrName]
);
}
}

@ -19,7 +19,7 @@ public class TenantSettingValueProvider : SettingValueProvider
CurrentTenant = currentTenant;
}
public override async Task<string> GetOrNullAsync(SettingDefinition setting)
public async override Task<string> GetOrNullAsync(SettingDefinition setting)
{
return await SettingStore.GetOrNullAsync(setting.Name, Name, CurrentTenant.Id?.ToString());
}

@ -16,8 +16,8 @@
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.Localization.Abstractions\Volo.Abp.Localization.Abstractions.csproj" />
<ProjectReference Include="..\Volo.Abp.MultiTenancy\Volo.Abp.MultiTenancy.csproj" />
<ProjectReference Include="..\Volo.Abp.Security\Volo.Abp.Security.csproj" />
<ProjectReference Include="..\Volo.Abp.Data\Volo.Abp.Data.csproj" />
</ItemGroup>
</Project>

@ -3,16 +3,16 @@ using System.Collections.Generic;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Security;
using Volo.Abp.Data;
namespace Volo.Abp.Settings;
[DependsOn(
typeof(AbpLocalizationAbstractionsModule),
typeof(AbpSecurityModule),
typeof(AbpMultiTenancyModule)
)]
typeof(AbpDataModule)
)]
public class AbpSettingsModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
@ -27,7 +27,6 @@ public class AbpSettingsModule : AbpModule
options.ValueProviders.Add<DefaultValueSettingValueProvider>();
options.ValueProviders.Add<ConfigurationSettingValueProvider>();
options.ValueProviders.Add<GlobalSettingValueProvider>();
options.ValueProviders.Add<TenantSettingValueProvider>();
options.ValueProviders.Add<UserSettingValueProvider>();
});
}

@ -1,12 +1,13 @@
using Volo.Abp.Authorization;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.UI.Navigation.Localization.Resource;
using Volo.Abp.VirtualFileSystem;
namespace Volo.Abp.UI.Navigation;
[DependsOn(typeof(AbpUiModule), typeof(AbpAuthorizationModule))]
[DependsOn(typeof(AbpUiModule), typeof(AbpAuthorizationModule), typeof(AbpMultiTenancyModule))]
public class AbpUiNavigationModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)

@ -0,0 +1,25 @@
using Microsoft.Extensions.Localization;
using Shouldly;
using Volo.Abp.Localization;
using Volo.Abp.MultiTenancy.Localization;
using Xunit;
namespace Volo.Abp.MultiTenancy;
public class MultiTenancyResource_Tests : MultiTenancyTestBase
{
[Fact]
public void MultiTenancyResource_Test()
{
var q = GetRequiredService<IStringLocalizer<AbpMultiTenancyResource>>();
using (CultureHelper.Use("en"))
{
GetRequiredService<IStringLocalizer<AbpMultiTenancyResource>>()["TenantNotFoundMessage"].Value.ShouldBe("Tenant not found!");
}
using (CultureHelper.Use("tr"))
{
GetRequiredService<IStringLocalizer<AbpMultiTenancyResource>>()["TenantNotFoundMessage"].Value.ShouldBe("Kiracı bulunamadı!");
}
}
}

@ -211,6 +211,7 @@ $projects = (
"framework/src/Volo.Abp.Localization",
"framework/src/Volo.Abp.MemoryDb",
"framework/src/Volo.Abp.MongoDB",
"framework/src/Volo.Abp.MultiTenancy.Abstractions",
"framework/src/Volo.Abp.MultiTenancy",
"framework/src/Volo.Abp.Minify",
"framework/src/Volo.Abp.ObjectExtending",

Loading…
Cancel
Save