PIbd-21_Ihonkina_E.S._Preca.../PrecastConcretePlantRestApi/Program.cs

44 lines
1.4 KiB
C#
Raw Normal View History

2023-04-05 22:10:29 +04:00
using Microsoft.OpenApi.Models;
using PrecastConcretePlantBusinessLogic.BusinessLogic;
using PrecastConcretePlantContracts.BusinessLogicsContracts;
using PrecastConcretePlantContracts.StoragesContracts;
using PrecastConcretePlantDatabaseImplement.Implements;
2023-04-05 20:18:52 +04:00
var builder = WebApplication.CreateBuilder(args);
2023-04-05 22:10:29 +04:00
builder.Logging.SetMinimumLevel(LogLevel.Trace);
builder.Logging.AddLog4Net("log4net.config");
2023-04-05 20:18:52 +04:00
// Add services to the container.
2023-04-05 22:10:29 +04:00
builder.Services.AddTransient<IClientStorage, ClientStorage>();
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
builder.Services.AddTransient<IReinforcedStorage, ReinforcedStorage>();
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
builder.Services.AddTransient<IClientLogic, ClientLogic>();
builder.Services.AddTransient<IReinforcedLogic, ReinforcedLogic>();
2023-04-05 20:18:52 +04:00
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
2023-04-05 22:10:29 +04:00
builder.Services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "ReinforcedCompanyRestApi", Version = "v1" });
});
2023-04-05 20:18:52 +04:00
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
2023-04-05 22:10:29 +04:00
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "ReinforcedCompanyRestApi v1"));
2023-04-05 20:18:52 +04:00
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
2023-04-05 22:10:29 +04:00
app.Run();