49 lines
1.6 KiB
C#
49 lines
1.6 KiB
C#
using ComputerStoreBusinessLogic.BusinessLogic;
|
|
using ComputerStoreContracts.BusinessLogicContracts;
|
|
using ComputerStoreContracts.StorageContracts;
|
|
using ComputerStoreDatabaseImplement.Implements;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
|
builder.Logging.AddLog4Net("log4net.config");
|
|
|
|
// Add services to the container.
|
|
|
|
builder.Services.AddTransient<IEmployeeStorage,EmployeeStorage>();
|
|
builder.Services.AddTransient<IComponentStorage, ComponentStorage>();
|
|
builder.Services.AddTransient<IPCStorage,PCStorage>();
|
|
builder.Services.AddTransient<IProductStorage, ProductStorage>();
|
|
builder.Services.AddTransient<IConsignmentStorage, ConsignmentStorage>();
|
|
|
|
builder.Services.AddTransient<IEmployeeLogic,EmployeeLogic>();
|
|
builder.Services.AddTransient<IComponentLogic, ComponentLogic>();
|
|
builder.Services.AddTransient<IEmployeeReportLogic, EmployeeReportLogic>();
|
|
builder.Services.AddTransient<IPCLogic, PCLogic>();
|
|
builder.Services.AddTransient<IProductLogic, ProductLogic>();
|
|
builder.Services.AddTransient<IConsignmentLogic,ConsignmentLogic>();
|
|
|
|
|
|
builder.Services.AddControllers().AddNewtonsoftJson(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);
|
|
|
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
builder.Services.AddSwaggerGen();
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (app.Environment.IsDevelopment())
|
|
{
|
|
app.UseSwagger();
|
|
app.UseSwaggerUI();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
app.UseAuthorization();
|
|
|
|
app.MapControllers();
|
|
|
|
app.Run();
|