From 9dddd9a4d9a194edec70be2a62fff18ddbb67188 Mon Sep 17 00:00:00 2001 From: ahmetfarukulu Date: Tue, 5 Mar 2024 08:32:51 +0300 Subject: [PATCH] TenantStore list method added --- .../Components/MauiBlazor/MauiBlazorRemoteTenantStore.cs | 6 ++++++ .../Volo/Abp/AspNetCore/Mvc/Client/MvcRemoteTenantStore.cs | 6 ++++++ .../Volo/Abp/MultiTenancy/ITenantStore.cs | 3 +++ .../MultiTenancy/ConfigurationStore/DefaultTenantStore.cs | 6 ++++++ .../Volo/Abp/TenantManagement/TenantStore.cs | 7 +++++++ 5 files changed, 28 insertions(+) diff --git a/framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor/Volo/Abp/AspNetCore/Components/MauiBlazor/MauiBlazorRemoteTenantStore.cs b/framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor/Volo/Abp/AspNetCore/Components/MauiBlazor/MauiBlazorRemoteTenantStore.cs index 3873b48db3..73fe9e6999 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor/Volo/Abp/AspNetCore/Components/MauiBlazor/MauiBlazorRemoteTenantStore.cs +++ b/framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor/Volo/Abp/AspNetCore/Components/MauiBlazor/MauiBlazorRemoteTenantStore.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.Extensions.Caching.Distributed; using Pages.Abp.MultiTenancy.ClientProxies; @@ -57,6 +58,11 @@ public class MauiBlazorRemoteTenantStore : ITenantStore, ITransientDependency return tenantConfiguration; } + public Task> GetListAsync(bool includeDetails = false) + { + return Task.FromResult>(Array.Empty()); + } + public TenantConfiguration? Find(string normalizedName) { var cacheKey = CreateCacheKey(normalizedName); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcRemoteTenantStore.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcRemoteTenantStore.cs index dce80a3099..ed4739c93c 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcRemoteTenantStore.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcRemoteTenantStore.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Options; @@ -79,6 +80,11 @@ public class MvcRemoteTenantStore : ITenantStore, ITransientDependency return tenantConfiguration?.Value; } + public Task> GetListAsync(bool includeDetails = false) + { + return Task.FromResult>(Array.Empty()); + } + public TenantConfiguration? Find(string normalizedName) { var cacheKey = TenantConfigurationCacheItem.CalculateCacheKey(normalizedName); diff --git a/framework/src/Volo.Abp.MultiTenancy.Abstractions/Volo/Abp/MultiTenancy/ITenantStore.cs b/framework/src/Volo.Abp.MultiTenancy.Abstractions/Volo/Abp/MultiTenancy/ITenantStore.cs index d97d438b01..0e992211ca 100644 --- a/framework/src/Volo.Abp.MultiTenancy.Abstractions/Volo/Abp/MultiTenancy/ITenantStore.cs +++ b/framework/src/Volo.Abp.MultiTenancy.Abstractions/Volo/Abp/MultiTenancy/ITenantStore.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Threading.Tasks; namespace Volo.Abp.MultiTenancy; @@ -9,6 +10,8 @@ public interface ITenantStore Task FindAsync(Guid id); + Task> GetListAsync(bool includeDetails = false); + [Obsolete("Use FindAsync method.")] TenantConfiguration? Find(string normalizedName); diff --git a/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/ConfigurationStore/DefaultTenantStore.cs b/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/ConfigurationStore/DefaultTenantStore.cs index e91e749fe3..78e902bd06 100644 --- a/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/ConfigurationStore/DefaultTenantStore.cs +++ b/framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/ConfigurationStore/DefaultTenantStore.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.Extensions.Options; @@ -26,6 +27,11 @@ public class DefaultTenantStore : ITenantStore, ITransientDependency return Task.FromResult(Find(id)); } + public Task> GetListAsync(bool includeDetails = false) + { + return Task.FromResult>(_options.Tenants); + } + public TenantConfiguration? Find(string normalizedName) { return _options.Tenants?.FirstOrDefault(t => t.NormalizedName == normalizedName); diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantStore.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantStore.cs index 808a9684cd..8f494ff45c 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantStore.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantStore.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Threading.Tasks; using JetBrains.Annotations; using Volo.Abp.Caching; @@ -37,6 +38,12 @@ public class TenantStore : ITenantStore, ITransientDependency return (await GetCacheItemAsync(id, null)).Value; } + public virtual async Task> GetListAsync(bool includeDetails = false) + { + return ObjectMapper.Map, List>( + await TenantRepository.GetListAsync(includeDetails)); + } + [Obsolete("Use FindAsync method.")] public virtual TenantConfiguration Find(string normalizedName) {