PIbd-23.Vrazhkin_S.A.RPP_ku.../AutoCenter/AutoCenterRestApi/Program.cs

57 lines
2.0 KiB
C#

using Microsoft.OpenApi.Models;
using AutoCenterBusinessLogic.BusinessLogics;
using AutoCenterContracts.BusinessLogicsContracts;
using AutoCenterContracts.StoragesContracts;
using AutoCenterDatabaseImplement.Implements;
var builder = WebApplication.CreateBuilder(args);
builder.Logging.SetMinimumLevel(LogLevel.Trace);
builder.Logging.AddLog4Net("log4net.config");
// Add services to the container.
builder.Services.AddTransient<ICarBrandStorage, CarBrandStorage>();
builder.Services.AddTransient<ICarStorage, CarStorage>();
builder.Services.AddTransient<IEquipmentStorage, EquipmentStorage>();
builder.Services.AddTransient<IPresellingWorkStorage, PresellingWorkStorage>();
builder.Services.AddTransient<IPurchaseStorage, PurchaseStorage>();
builder.Services.AddTransient<IShopStorage, ShopStorage>();
builder.Services.AddTransient<IUserStorage, UserStorage>();
builder.Services.AddTransient<IWishStorage, WishStorage>();
builder.Services.AddTransient<ICarBrandLogic, CarBrandLogic>();
builder.Services.AddTransient<ICarLogic, CarLogic>();
builder.Services.AddTransient<IEquipmentLogic, EquipmentLogic>();
builder.Services.AddTransient<IPresellingWorkLogic, PresellingWorkLogic>();
builder.Services.AddTransient<IPurchaseLogic, PurchaseLogic>();
builder.Services.AddTransient<IShopLogic, ShopLogic>();
builder.Services.AddTransient<IUserLogic, UserLogic>();
builder.Services.AddTransient<IWishLogic, WishLogic>();
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "AutoCenterRestApi", Version = "v1" });
});
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "AutoCenterRestApi v1"));
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();