zeroframework/Services/Identity/ZeroFramework.IdentityServer.API/Tenants/TenantMiddlewareExtensions.cs

20 lines
700 B
C#
Raw Normal View History

2023-12-05 09:22:48 +00:00
namespace ZeroFramework.IdentityServer.API.Tenants
{
public static class TenantMiddlewareExtensions
{
public static IServiceCollection AddTenantMiddleware(this IServiceCollection services)
{
services.AddSingleton<ICurrentTenantAccessor, CurrentTenantAccessor>();
services.AddTransient<ICurrentTenant, CurrentTenant>();
services.AddTransient<ITenantProvider, TenantProvider>();
return services.AddTransient<TenantMiddleware>();
}
public static IApplicationBuilder UseTenantMiddleware(this IApplicationBuilder builder)
{
return builder.UseMiddleware<TenantMiddleware>();
}
}
}