PIbd-21_Danilov_V.V._Course.../VeterinaryClinic/VeterinaryClinicRestApi/Program.cs

57 lines
1.8 KiB
C#
Raw Normal View History

2024-05-01 03:06:53 +04:00
using VeterinaryClinicBusinessLogics.BusinessLogics;
using VeterinaryClinicContracts.BusinessLogicsContracts;
using VeterinaryClinicContracts.StoragesContracts;
using VeterinaryClinicDatabaseImplement.Implements;
using Microsoft.OpenApi.Models;
var builder = WebApplication.CreateBuilder(args);
builder.Logging.SetMinimumLevel(LogLevel.Trace);
2024-05-01 23:10:05 +04:00
//builder.Logging.AddLog4Net("log4net.config");
2024-05-01 03:06:53 +04:00
// Add services to the container.
builder.Services.AddTransient<IAnimalStorage, AnimalStorage>();
builder.Services.AddTransient<IMedicationStorage, MedicationStorage>();
builder.Services.AddTransient<IServiceStorage, ServiceStorage>();
builder.Services.AddTransient<IUserStorage, UserStorage>();
builder.Services.AddTransient<IVaccinationStorage, VaccinationStorage>();
builder.Services.AddTransient<IVisitStorage, VisitStorage>();
builder.Services.AddTransient<IAnimalLogic, AnimalLogic>();
builder.Services.AddTransient<IMedicationLogic, MedicationLogic>();
builder.Services.AddTransient<IServiceLogic, ServiceLogic>();
builder.Services.AddTransient<IUserLogic, UserLogic>();
builder.Services.AddTransient<IVaccinationLogic, VaccinationLogic>();
builder.Services.AddTransient<IVisitLogic, VisitLogic>();
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 = "VeterinaryClinicRestApi",
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", "VeterinaryClinicRestApi v1"));
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();