First Commit

This commit is contained in:
Jorge Luis caudillo esparza
2026-05-09 16:36:57 -07:00
parent 96ad4c0d3e
commit d0c284d9c0
131 changed files with 4009 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
using ADS.Helpers.MultiTenant.Abstractions;
using ADS.Helpers.MultiTenant.Context;
using Microsoft.Extensions.Configuration;
namespace ADS.Helpers.MultiTenant.Stores;
public sealed class ConfigurationTenantStore : ITenantStore
{
private readonly IConfiguration _cfg;
public ConfigurationTenantStore(IConfiguration cfg) => _cfg = cfg;
public Task<TenantContext?> GetAsync(string tenantKey)
{
var section = _cfg.GetSection($"Tenants:{tenantKey}");
if (!section.Exists()) return Task.FromResult<TenantContext?>(null);
var tenant = section.Get<TenantContext>() ?? new TenantContext();
tenant.TenantId = tenantKey; // importante
return Task.FromResult<TenantContext?>(tenant);
}
}