Files
Yi.Admin/src/Yi.Framework/Yi.Framework.Web/Program.cs

71 lines
1.8 KiB
C#
Raw Normal View History

2023-01-11 11:10:59 +08:00
using AspNetCore.Microsoft.AspNetCore.Builder;
using System.Reflection;
using Yi.Framework.Application;
using Yi.Framework.Application.Contracts;
using Yi.Framework.Autofac.Extensions;
using Yi.Framework.Core;
using Yi.Framework.Core.AutoMapper;
using Yi.Framework.Core.Extensions;
using Yi.Framework.Core.Sqlsugar;
using Yi.Framework.Core.Sqlsugar.Repository;
using Yi.Framework.Ddd;
using Yi.Framework.Ddd.Repository;
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);
builder.WebHost.UseUrls(builder.Configuration.GetValue<string>("StartUrl"));
//<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
builder.UseYiModules(
typeof(YiFrameworkCoreModule).Assembly,
typeof(YiFrameworkCoreAutoMapperModule).Assembly,
typeof(YiFrameworkDddModule).Assembly,
typeof(YiFrameworkCoreSqlsugarModule).Assembly,
typeof(YiFrameworkSqlsugarModule).Assembly,
typeof(YiFrameworkDomainSharedModule).Assembly,
typeof(YiFrameworkDomainModule).Assembly,
typeof(YiFrameworkApplicationContractsModule).Assembly,
typeof(YiFrameworkApplicationModule).Assembly
);
//ʹ<><CAB9>autofac
builder.Host.UseAutoFacServerProviderFactory();
//<2F><><EFBFBD>ӿ<EFBFBD><D3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>붯̬api
builder.Services.AddControllers();
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);
});
//<2F><><EFBFBD><EFBFBD>swagger
builder.Services.AddSwaggerServer<YiFrameworkApplicationModule>();
2023-01-11 11:10:59 +08:00
var app = builder.Build();
app.Services.GetRequiredService<IRepository<TestEntity>>();
//if (app.Environment.IsDevelopment())
{
app.UseSwaggerServer();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.UseRouting();
//ʹ<>ö<EFBFBD>̬api
app.UseAutoApiService();
app.MapControllers();
app.Run();