mirror of https://github.com/abpframework/abp.git
62 changed files with 278 additions and 34 deletions
@ -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"); |
|||
}); |
|||
} |
|||
} |
|||
@ -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; |
|||
} |
|||
} |
|||
@ -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ı!"); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue