Илья Федотов 64ba40c90c Base.02
2024-05-01 21:05:07 +04:00

51 lines
1.5 KiB
C#

using DinerContracts.BusinessLogicsContacts;
using DinerContracts.BusinessLogicsContracts;
using DinerContracts.StoragesContracts;
using DinerDataBaseImplement.Implements;
using DineryBusinessLogic.BusinessLogic;
using Microsoft.OpenApi.Models;
namespace DinerRestAPI {
public class Program {
public static void Main(string[] args) {
var builder = WebApplication.CreateBuilder(args);
builder.Logging.SetMinimumLevel(LogLevel.Trace);
builder.Logging.AddLog4Net("log4net.config");
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
builder.Services.AddTransient<ISnackStorage, SnackStorage>();
builder.Services.AddTransient<IClientStorage, ClientStorage>();
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
builder.Services.AddTransient<ISnackLogic, SnackLogic>();
builder.Services.AddTransient<IClientLogic, ClientLogic>();
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(x => x.SwaggerDoc("v1", new OpenApiInfo { Title = "DinerRestApi", Version = "v1" }));
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment()) {
app.UseSwagger();
app.UseSwaggerUI(x => x.SwaggerEndpoint("/swagger/v1/swagger.json", "DinerRestApi v1"));
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();
}
}
}