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:
@@ -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>();
|
||||
|
||||
Reference in New Issue
Block a user