Илья Федотов 08017d171e Base.01
2024-05-13 16:49:39 +04:00

54 lines
1.7 KiB
C#

using DinerContracts.BusinessLogicsContacts;
using DinerContracts.BusinessLogicsContracts;
using DinerContracts.StoragesContracts;
using DinerDataBaseImplement.Implements;
using DineryBusinessLogic.BusinessLogic;
using DocumentFormat.OpenXml.VariantTypes;
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<IImplementerStorage, ImplementerStorage>();
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
builder.Services.AddTransient<ISnackLogic, SnackLogic>();
builder.Services.AddTransient<IClientLogic, ClientLogic>();
builder.Services.AddTransient<IImplementerLogic, ImplementerLogic>();
// 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(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "DinerRestApi v1"));
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();
}
}
}