using DigitalData.Core.CultureServices; using DigitalData.UserManager.Infrastructure.Repositories; using EnvelopeGenerator.Application.Contracts; using EnvelopeGenerator.Application.MappingProfiles; using EnvelopeGenerator.Application.Services; using EnvelopeGenerator.Infrastructure.Contracts; using EnvelopeGenerator.Infrastructure.Repositories; using EnvelopeGenerator.Web.Services; using Microsoft.EntityFrameworkCore; using Quartz; namespace EnvelopeGenerator.Web { public class Program { public static void Main(string[] args) { var builder = WebApplication.CreateBuilder(args); // Add base services builder.Services.AddSingleton(); builder.Services.AddScoped(); // Add higher order services builder.Services.AddScoped(); // Add services to the container. builder.Services.AddControllersWithViews().AddJsonOptions(q => { // Prevents serialization error when serializing SvgBitmap in EnvelopeReceiver q.JsonSerializerOptions.ReferenceHandler = System.Text.Json.Serialization.ReferenceHandler.IgnoreCycles; }); builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); builder.Services.AddKeyTranslationService(); //AddEF Core dbcontext var connStr = builder.Configuration["Config:ConnectionString"]; builder.Services.AddDbContext(options => options.UseSqlServer(connStr)); //Inject CRUD Service and repositories builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); //Auto mapping profiles builder.Services.AddAutoMapper(typeof(BasicDtoMappingProfile).Assembly); var app = builder.Build(); // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/Home/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseSwagger(); app.UseSwaggerUI(); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); app.MapControllers(); app.Run(); } } }