Added instrastructure extensions
Implemented database service registration
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
using static PostFundManagement.Infrastructure.Extensions.Constants;
|
||||
|
||||
namespace PostFundManagement.Infrastructure.Database;
|
||||
|
||||
public sealed class ApplicationDbContextFactory : IDesignTimeDbContextFactory<ApplicationDbContext>
|
||||
@@ -12,8 +14,8 @@ public sealed class ApplicationDbContextFactory : IDesignTimeDbContextFactory<Ap
|
||||
|
||||
var optionsBuilder = new DbContextOptionsBuilder<ApplicationDbContext>();
|
||||
|
||||
var connectionString = configuration.GetConnectionString("PfmDatabase")
|
||||
?? throw new InvalidOperationException("Connection string 'PfmDatabase' was not found in configuration.");
|
||||
var connectionString = configuration.GetConnectionString(DatabaseConfigName)
|
||||
?? throw new InvalidOperationException($"Connection string '{DatabaseConfigName}' was not found in configuration.");
|
||||
|
||||
optionsBuilder.UseNpgsql(connectionString, npgsqlOptions => npgsqlOptions.MigrationsAssembly(typeof(ApplicationDbContext).Assembly.FullName));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user