using Back.Data.Contracts; using Back.Data.Infrastructure.Repository; using Back.Services; using Back.Validations; using Microsoft.EntityFrameworkCore; using TaxPayer.Infrastructure.Persistence; var builder = WebApplication.CreateBuilder(args); // 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(); builder.Services.AddDbContext(options => { options.UseSqlServer(builder.Configuration.GetConnectionString("Base")); }); builder.Services.AddScoped(typeof(IAsyncRepository<>), typeof(RepositoryBase<>)); builder.Services.AddScoped(); builder.Services.AddScoped (); builder.Services.AddScoped(); builder.Services.AddScoped (); builder.Services.AddScoped < ServValidatinMsg>(); builder.Services.AddScoped (); string origins = "OriginTaxPayer"; builder.Services.AddCors(options => { options.AddPolicy(origins, policy => { policy.WithOrigins("https://localhost:7224", "http://localhost:5107") .AllowAnyHeader() .AllowAnyMethod(); }); }); var app = builder.Build(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { app.UseSwagger(); app.UseSwaggerUI(); } app.UseHttpsRedirection(); app.UseCors(origins); app.UseAuthorization(); app.MapControllers(); app.Run();