Browse Source

TenantStore list method added

pull/19258/head
ahmetfarukulu 3 years ago
parent
commit
bd4621af27
  1. 6
      framework/src/Volo.Abp.AspNetCore.Components.MauiBlazor/Volo/Abp/AspNetCore/Components/MauiBlazor/MauiBlazorRemoteTenantStore.cs
  2. 6
      framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcRemoteTenantStore.cs
  3. 3
      framework/src/Volo.Abp.MultiTenancy.Abstractions/Volo/Abp/MultiTenancy/ITenantStore.cs
  4. 6
      framework/src/Volo.Abp.MultiTenancy/Volo/Abp/MultiTenancy/ConfigurationStore/DefaultTenantStore.cs
  5. 7
      modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantStore.cs

6
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<IReadOnlyList<TenantConfiguration>> GetListAsync(bool includeDetails = false)
{
return Task.FromResult<IReadOnlyList<TenantConfiguration>>(Array.Empty<TenantConfiguration>());
}
public TenantConfiguration? Find(string normalizedName)
{
var cacheKey = CreateCacheKey(normalizedName);

6
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<IReadOnlyList<TenantConfiguration>> GetListAsync(bool includeDetails = false)
{
return Task.FromResult<IReadOnlyList<TenantConfiguration>>(Array.Empty<TenantConfiguration>());
}
public TenantConfiguration? Find(string normalizedName)
{
var cacheKey = TenantConfigurationCacheItem.CalculateCacheKey(normalizedName);

3
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<TenantConfiguration?> FindAsync(Guid id);
Task<IReadOnlyList<TenantConfiguration>> GetListAsync(bool includeDetails = false);
[Obsolete("Use FindAsync method.")]
TenantConfiguration? Find(string normalizedName);

6
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<IReadOnlyList<TenantConfiguration>> GetListAsync(bool includeDetails = false)
{
return Task.FromResult<IReadOnlyList<TenantConfiguration>>(_options.Tenants);
}
public TenantConfiguration? Find(string normalizedName)
{
return _options.Tenants?.FirstOrDefault(t => t.NormalizedName == normalizedName);

7
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<IReadOnlyList<TenantConfiguration>> GetListAsync(bool includeDetails = false)
{
return ObjectMapper.Map<List<Tenant>, List<TenantConfiguration>>(
await TenantRepository.GetListAsync(includeDetails));
}
[Obsolete("Use FindAsync method.")]
public virtual TenantConfiguration Find(string normalizedName)
{

Loading…
Cancel
Save