这是基于vue-vben-admin 模板适用于abp Vnext的前端管理项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

102 lines
3.8 KiB

using LINGYUN.Abp.AspNetCore.HttpOverrides;
using LINGYUN.Abp.AuditLogging.Elasticsearch;
using LINGYUN.Abp.EventBus.CAP;
using LINGYUN.Abp.Localization.CultureMap;
using LINGYUN.Abp.MultiTenancy.DbFinder;
using LINGYUN.Abp.Serilog.Enrichers.Application;
using LINGYUN.ApiGateway.EntityFrameworkCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Volo.Abp;
using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.Autofac;
using Volo.Abp.Caching.StackExchangeRedis;
using Volo.Abp.EntityFrameworkCore.MySQL;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.TenantManagement.EntityFrameworkCore;
namespace LINGYUN.ApiGateway
{
[DependsOn(
typeof(AbpSerilogEnrichersApplicationModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpAuditLoggingElasticsearchModule),
typeof(ApiGatewayApplicationModule),
typeof(ApiGatewayEntityFrameworkCoreModule),
typeof(ApiGatewayHttpApiModule),
typeof(AbpEntityFrameworkCoreMySQLModule),
typeof(AbpTenantManagementEntityFrameworkCoreModule),
typeof(AbpSettingManagementEntityFrameworkCoreModule),
typeof(AbpPermissionManagementEntityFrameworkCoreModule),
typeof(AbpCAPEventBusModule),
typeof(AbpDbFinderMultiTenancyModule),
typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpAspNetCoreHttpOverridesModule),
typeof(AbpLocalizationCultureMapModule),
typeof(AbpAutofacModule)
)]
public partial class ApiGatewayHttpApiHostModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
PreConfigureApp();
PreConfigureCAP(configuration);
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = hostingEnvironment.BuildConfiguration();
ConfigureDbContext();
ConfigureAutoMapper();
ConfigureJsonSerializer();
ConfigureVirtualFileSystem();
ConfigureCaching(configuration);
ConfigureMultiTenancy(configuration);
ConfigureAuditing(configuration);
ConfigureSwagger(context.Services);
ConfigureLocalization();
ConfigureSecurity(context.Services, configuration, hostingEnvironment.IsDevelopment());
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
// http调用链
app.UseCorrelationId();
// 虚拟文件系统
app.UseStaticFiles();
//路由
app.UseRouting();
// 认证
app.UseAuthentication();
// 多租户
// app.UseMultiTenancy();
// 本地化
app.UseMapRequestLocalization();
// 认证
app.UseAuthorization();
// Swagger
app.UseSwagger();
// Swagger可视化界面
app.UseSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Support ApiGateway API");
});
// 审计日志
app.UseAuditing();
app.UseAbpSerilogEnrichers();
// 路由
app.UseConfiguredEndpoints();
SeedData(context);
}
}
}