PIbd-21_Yaruskin_S.A_MotorP.../MotorPlant/MotorPlantRestApi/Program.cs

54 lines
1.5 KiB
C#
Raw Normal View History

2024-05-25 11:08:14 +04:00
using Microsoft.OpenApi.Models;
2024-05-17 06:06:37 +04:00
using MotorPlantBusinessLogic.BusinessLogic;
2024-04-07 23:57:23 +04:00
using MotorPlantBusinessLogic.BusinessLogics;
using MotorPlantContracts.BusinessLogicsContracts;
using MotorPlantContracts.StoragesContracts;
using MotorPlantDatabaseImplement.Implements;
2024-05-17 06:06:37 +04:00
using MotorPlantRestApi;
2024-04-07 23:57:23 +04:00
var builder = WebApplication.CreateBuilder(args);
builder.Logging.SetMinimumLevel(LogLevel.Trace);
builder.Logging.AddLog4Net("log4net.config");
builder.Services.AddTransient<IClientStorage, ClientStorage>();
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
builder.Services.AddTransient<IEngineStorage, EngineStorage>();
2024-05-17 06:06:37 +04:00
builder.Services.AddTransient<IShopStorage, ShopStorage>();
2024-04-07 23:57:23 +04:00
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
builder.Services.AddTransient<IClientLogic, ClientLogic>();
builder.Services.AddTransient<IEngineLogic, EngineLogic>();
2024-05-17 06:06:37 +04:00
builder.Services.AddTransient<IShopLogic, ShopLogic>();
2024-04-07 23:57:23 +04:00
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo
{
Title = "MotorPlantRestApi",
Version = "v1"
});
});
var app = builder.Build();
2024-05-17 06:06:37 +04:00
APIConfig.LoadData(builder.Configuration);
2024-04-07 23:57:23 +04:00
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "MototPlantRestApi v1"));
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();