2023-01-11 11:10:59 +08:00
|
|
|
|
2023-01-11 15:05:31 +08:00
|
|
|
using AspNetCore.Microsoft.AspNetCore.Builder;
|
|
|
|
|
using Panda.DynamicWebApi;
|
|
|
|
|
using Yi.Framework.Application;
|
|
|
|
|
using Yi.Framework.Core;
|
2023-01-11 11:10:59 +08:00
|
|
|
using Yi.Framework.Core.Extensions;
|
2023-01-11 15:05:31 +08:00
|
|
|
using Yi.Framework.Core.Sqlsugar;
|
|
|
|
|
using Yi.Framework.Core.Sqlsugar.Repository;
|
|
|
|
|
using Yi.Framework.Ddd;
|
|
|
|
|
using Yi.Framework.Ddd.Repository;
|
|
|
|
|
using Yi.Framework.Web;
|
2023-01-11 11:10:59 +08:00
|
|
|
|
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
|
|
2023-01-11 15:05:31 +08:00
|
|
|
builder.UseYiModules(
|
|
|
|
|
typeof(YiFrameworkCoreModule).Assembly,
|
|
|
|
|
typeof(YiFrameworkDddModule).Assembly,
|
|
|
|
|
typeof(YiFrameworkCoreSqlsugarModule).Assembly
|
|
|
|
|
);
|
2023-01-11 11:10:59 +08:00
|
|
|
builder.Services.AddControllers();
|
2023-01-11 15:05:31 +08:00
|
|
|
builder.Services.AddDynamicWebApi();
|
|
|
|
|
|
|
|
|
|
|
2023-01-11 11:10:59 +08:00
|
|
|
builder.Services.AddEndpointsApiExplorer();
|
2023-01-11 15:05:31 +08:00
|
|
|
|
|
|
|
|
builder.Services.AddSwaggerServer<YiFrameworkApplicationModule>();
|
|
|
|
|
//builder.Services.AddAutoIocServer("Yi.Framework.Core.Sqlsugar");
|
|
|
|
|
|
2023-01-11 11:10:59 +08:00
|
|
|
|
|
|
|
|
var app = builder.Build();
|
|
|
|
|
|
2023-01-11 15:05:31 +08:00
|
|
|
app.Services.GetRequiredService<IRepository<TestEntity>>();
|
|
|
|
|
//if (app.Environment.IsDevelopment())
|
2023-01-11 11:10:59 +08:00
|
|
|
{
|
2023-01-11 15:05:31 +08:00
|
|
|
app.UseSwaggerServer();
|
2023-01-11 11:10:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
|
|
|
|
|
|
app.UseAuthorization();
|
|
|
|
|
|
2023-01-11 15:05:31 +08:00
|
|
|
app.UseRouting();
|
2023-01-11 11:10:59 +08:00
|
|
|
app.MapControllers();
|
|
|
|
|
|
|
|
|
|
app.Run();
|