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