using System.Reflection; using DtoAbstractLayer; using LibraryDTO; using Microsoft.OpenApi.Models; using MyLibraryManager; using OpenLibraryClient; using StubbedDTO; var dto = System.Environment.GetEnvironmentVariable("DTO", System.EnvironmentVariableTarget.Process); var builder = WebApplication.CreateBuilder(args); // Add services to the container. switch(dto) { case "Wrapper": builder.Services.AddSingleton(); break; case "Database": builder.Services.AddSingleton(); break; default: builder.Services.AddSingleton(); break; } builder.Services.AddControllers(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(options => { options.SwaggerDoc( "v1", new OpenApiInfo { Title = "My Open Library API", Version = "v1", Description="A Web API for managing books, authors and works" }); }); var app = builder.Build(); app.UseHttpsRedirection(); app.UseAuthorization(); app.UseSwagger(); app.UseSwaggerUI(options => { options.SwaggerEndpoint("/docs/swagger.json", "v1"); }); app.MapControllers(); app.Run();