Register DbContext and AutoMapper with DI, add TODOs

Added ApplicationDbContext and AutoMapper registrations to the DI container in Program.cs. Included TODO comments to extract these registrations into extension methods for better reuse across projects.
This commit is contained in:
2026-01-16 13:45:15 +01:00
parent 87031d2a0a
commit ca563f1d0c

View File

@@ -23,9 +23,11 @@ builder.Services.AddCors(options =>
});
});
// TODO: Create extension method for this in Infrastructure layer in case of using in multiple projects
builder.Services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));
// TODO: Create extension method for this in Application layer in case of using in multiple projects
builder.Services.AddAutoMapper(typeof(CatalogProfile).Assembly, typeof(ApplicationDbContext).Assembly);
builder.Services.AddScoped<ICatalogRepository, CatalogRepository>();