using Microsoft.AspNetCore.Mvc.Formatters; using sodoff.Model; using sodoff.Services; using sodoff.Utils; using System.Xml; var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddControllers(options => { options.OutputFormatters.Add(new XmlSerializerOutputFormatter(new XmlWriterSettings() { OmitXmlDeclaration = false })); options.OutputFormatters.RemoveType(); options.Filters.Add(); }); builder.Services.AddDbContext(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); var app = builder.Build(); using var scope = app.Services.CreateScope(); scope.ServiceProvider.GetRequiredService().Database.EnsureCreated(); // Configure the HTTP request pipeline. app.UseAuthorization(); app.MapControllers(); app.Run();