2023-01-11 11:10:59 +08:00
|
|
|
|
|
2023-01-11 15:05:31 +08:00
|
|
|
|
using AspNetCore.Microsoft.AspNetCore.Builder;
|
2023-01-11 18:16:58 +08:00
|
|
|
|
using System.Reflection;
|
2023-01-11 15:05:31 +08:00
|
|
|
|
using Yi.Framework.Application;
|
2023-01-12 14:58:16 +08:00
|
|
|
|
using Yi.Framework.Application.Contracts;
|
2023-01-11 18:16:58 +08:00
|
|
|
|
using Yi.Framework.Autofac.Extensions;
|
2023-01-11 15:05:31 +08:00
|
|
|
|
using Yi.Framework.Core;
|
2023-01-11 18:16:58 +08:00
|
|
|
|
using Yi.Framework.Core.AutoMapper;
|
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;
|
2023-01-12 14:58:16 +08:00
|
|
|
|
using Yi.Framework.Domain;
|
|
|
|
|
|
using Yi.Framework.Domain.Shared;
|
|
|
|
|
|
using Yi.Framework.Sqlsugar;
|
2023-01-11 15:05:31 +08:00
|
|
|
|
using Yi.Framework.Web;
|
2023-01-11 11:10:59 +08:00
|
|
|
|
|
|
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
|
|
|
2023-01-11 18:16:58 +08:00
|
|
|
|
builder.WebHost.UseUrls(builder.Configuration.GetValue<string>("StartUrl"));
|
|
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
2023-01-11 15:05:31 +08:00
|
|
|
|
builder.UseYiModules(
|
|
|
|
|
|
typeof(YiFrameworkCoreModule).Assembly,
|
2023-01-11 18:16:58 +08:00
|
|
|
|
typeof(YiFrameworkCoreAutoMapperModule).Assembly,
|
2023-01-11 15:05:31 +08:00
|
|
|
|
typeof(YiFrameworkDddModule).Assembly,
|
2023-01-12 14:58:16 +08:00
|
|
|
|
typeof(YiFrameworkCoreSqlsugarModule).Assembly,
|
|
|
|
|
|
|
|
|
|
|
|
typeof(YiFrameworkSqlsugarModule).Assembly,
|
|
|
|
|
|
typeof(YiFrameworkDomainSharedModule).Assembly,
|
|
|
|
|
|
typeof(YiFrameworkDomainModule).Assembly,
|
|
|
|
|
|
typeof(YiFrameworkApplicationContractsModule).Assembly,
|
|
|
|
|
|
typeof(YiFrameworkApplicationModule).Assembly
|
2023-01-11 15:05:31 +08:00
|
|
|
|
);
|
|
|
|
|
|
|
2023-01-11 18:16:58 +08:00
|
|
|
|
//ʹ<><CAB9>autofac
|
|
|
|
|
|
builder.Host.UseAutoFacServerProviderFactory();
|
2023-01-11 15:05:31 +08:00
|
|
|
|
|
2023-01-11 18:16:58 +08:00
|
|
|
|
//<2F><><EFBFBD>ӿ<EFBFBD><D3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>붯̬api
|
|
|
|
|
|
builder.Services.AddControllers();
|
2023-01-13 13:40:54 +08:00
|
|
|
|
builder.Services.AddAutoApiService(opt =>
|
|
|
|
|
|
{
|
|
|
|
|
|
//NETServiceTest<73><74><EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽ<EFBFBD><D3BD><EFBFBD>̬api<70><69><EFBFBD><EFBFBD>
|
|
|
|
|
|
opt.CreateConventional(typeof(YiFrameworkApplicationModule).Assembly);
|
|
|
|
|
|
});
|
2023-01-11 15:05:31 +08:00
|
|
|
|
|
2023-01-11 18:16:58 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD>swagger
|
2023-01-11 15:05:31 +08:00
|
|
|
|
builder.Services.AddSwaggerServer<YiFrameworkApplicationModule>();
|
|
|
|
|
|
|
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-13 13:40:54 +08:00
|
|
|
|
|
|
|
|
|
|
//ʹ<>ö<EFBFBD>̬api
|
|
|
|
|
|
app.UseAutoApiService();
|
2023-01-11 11:10:59 +08:00
|
|
|
|
app.MapControllers();
|
|
|
|
|
|
|
|
|
|
|
|
app.Run();
|