Refactor DbContext configuration for flexibility

Updated `ConfigureDbContext` to accept `IServiceProvider`, enabling dependency injection during database context setup. Modified `DependencyInjection.cs` to align with this change by updating `DbContextOptionsAction` and its related method signature.

Removed unused `System.IO` and `System.Text.Json` namespaces from `RecActionController.cs` to improve code cleanliness.
This commit is contained in:
2025-12-03 11:47:04 +01:00
parent dc408e7794
commit 60e5adbf1a
3 changed files with 3 additions and 4 deletions

View File

@@ -16,7 +16,7 @@ builder.Services.AddRecServices(options =>
builder.Services.AddRecInfrastructure(options =>
{
options.ConfigureDbContext((dbContextOpt) =>
options.ConfigureDbContext((provider, dbContextOpt) =>
{
var connectionString = builder.Configuration.GetConnectionString("Default")
?? throw new InvalidOperationException("Connection string is not found.");