Revert "更改abp.vnext"

This reverts commit c905489ea5.
This commit is contained in:
橙子
2023-01-14 18:16:16 +08:00
parent 022d5bbd7d
commit 3a9ad5adb8
22 changed files with 196 additions and 168 deletions

View File

@@ -1,73 +1,17 @@
using Microsoft.AspNetCore.Cors;
using Microsoft.OpenApi.Models;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Modularity;
using Volo.Abp.Swashbuckle;
using Yi.Framework.Application;
using Yi.Framework.Sqlsugar;
using StartupModules;
namespace Yi.Framework.Web
{
[DependsOn(
typeof(AbpSwashbuckleModule),
typeof(YiFrameworkApplicationModule),
typeof(YiFrameworkSqlsugarModule),
typeof(AbpAspNetCoreMvcModule)
)]
public class YiFrameworkWebModule : AbpModule
public class YiFrameworkWebModule : IStartupModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
{
ConfigureAutoApiControllers();
ConfigureSwaggerServices(context.Services);
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
{
var app = context.GetApplicationBuilder();
app.UseStaticFiles();
app.UseRouting();
app.UseSwagger();
app.UseAbpSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "YiFramework API");
});
app.UseConfiguredEndpoints();
}
private void ConfigureAutoApiControllers()
{
Configure<AbpAspNetCoreMvcOptions>(options =>
{
options.ConventionalControllers.Create(typeof(YiFrameworkApplicationModule).Assembly);
});
}
private void ConfigureSwaggerServices(IServiceCollection services)
{
services.AddSwaggerGen(
options =>
{
options.SwaggerDoc("v1", new OpenApiInfo { Title = "YiFramework API", Version = "v1" });
options.DocInclusionPredicate((docName, description) => true);
options.CustomSchemaIds(type => type.FullName);
var basePath = Path.GetDirectoryName(this.GetType().Assembly.Location);
if (basePath is not null)
{
foreach (var item in Directory.GetFiles(basePath, "*.xml"))
{
options.IncludeXmlComments(item, true);
}
}
}
);
Console.WriteLine("还有谁");
}
}
}