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.
51 lines
1.7 KiB
51 lines
1.7 KiB
using Lion.AbpPro.AspNetCore;
|
|
|
|
namespace MyCompanyName.MyProjectName.MyModuleName;
|
|
|
|
[DependsOn(
|
|
typeof(AbpProAspNetCoreModule),
|
|
typeof(MyModuleNameApplicationModule),
|
|
typeof(MyModuleNameEntityFrameworkCoreModule),
|
|
typeof(MyModuleNameHttpApiModule),
|
|
typeof(AbpEntityFrameworkCorePostgreSqlModule),
|
|
typeof(AbpAspNetCoreSerilogModule)
|
|
)]
|
|
public class MyModuleNameHttpApiHostModule : AbpModule
|
|
{
|
|
public override void PreConfigureServices(ServiceConfigurationContext context)
|
|
{
|
|
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
|
}
|
|
|
|
public override void ConfigureServices(ServiceConfigurationContext context)
|
|
{
|
|
context.Services.AddAbpProSwagger("MyProjectName")
|
|
.AddAbpProCors()
|
|
.AddAbpProLocalization()
|
|
.AddAbpProExceptions()
|
|
.AddAbpProHealthChecks()
|
|
.AddAbpProTenantResolvers()
|
|
.AddAbpProMultiTenancy()
|
|
.AddAbpProAntiForgery()
|
|
.AddAbpProVirtualFileSystem()
|
|
.AddAbpProDbContext()
|
|
.AddAlwaysAllowAuthorization();
|
|
}
|
|
|
|
public override void OnApplicationInitialization(ApplicationInitializationContext context)
|
|
{
|
|
var app = context.GetApplicationBuilder();
|
|
app.UseAbpProRequestLocalization();
|
|
app.UseCorrelationId();
|
|
app.MapAbpStaticAssets();
|
|
app.UseRouting();
|
|
app.UseAbpProCors();
|
|
app.UseAuthentication();
|
|
app.UseAbpProMultiTenancy();
|
|
app.UseAuthorization();
|
|
app.UseAbpProSwaggerUI("/swagger/MyProjectName/swagger.json", "MyProjectName");
|
|
app.UseAbpSerilogEnrichers();
|
|
app.UseUnitOfWork();
|
|
app.UseConfiguredEndpoints(endpoints => { endpoints.MapHealthChecks("/health"); });
|
|
}
|
|
}
|