renaming
This commit is contained in:
19
5/Data/PostgresApplicationDbContextFactory.cs
Normal file
19
5/Data/PostgresApplicationDbContextFactory.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Design;
|
||||
|
||||
namespace Example.Data;
|
||||
|
||||
public sealed class PostgresApplicationDbContextFactory : IDesignTimeDbContextFactory<PostgresApplicationDbContext>
|
||||
{
|
||||
public PostgresApplicationDbContext CreateDbContext(string[] args)
|
||||
{
|
||||
var configuration = DesignTimeConfiguration.Create(includeDevelopmentSettings: false);
|
||||
var connectionString = configuration.GetConnectionString("DefaultConnection")
|
||||
?? throw new InvalidOperationException("Connection string 'DefaultConnection' was not found.");
|
||||
|
||||
var optionsBuilder = new DbContextOptionsBuilder<PostgresApplicationDbContext>();
|
||||
optionsBuilder.UseNpgsql(connectionString);
|
||||
|
||||
return new PostgresApplicationDbContext(optionsBuilder.Options);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user