零框架多租户设计方案
This commit is contained in:
1 parent
b7caaa2d0c
commit
b4a704526d
42 files changed
+1002
-1
No files matched your search
+23
@@ -0,0 +1,23 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace MultiTenancySample.ServiceDefaults
|
||||
{
|
||||
public static class MultiTenancyExtensions
|
||||
{
|
||||
public static IServiceCollection AddMultiTenancy(this IServiceCollection services)
|
||||
{
|
||||
services.AddScoped<ICurrentTenant, CurrentTenant>();
|
||||
services.AddScoped<ITenantIdProvider, TenantIdProvider>();
|
||||
|
||||
return services.AddScoped<TenantMiddleware>();
|
||||
}
|
||||
|
||||
public static IApplicationBuilder UseMultiTenancy(this IApplicationBuilder app)
|
||||
{
|
||||
app.UseMiddleware<TenantMiddleware>();
|
||||
|
||||
return app;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user