slarny4/Demo1/Data/RemoteData/RemoteDataBase/DesignTimeDbContextFactoryBase.cs

18 lines
680 B
C#
Raw Normal View History

2024-10-28 12:42:04 +00:00
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
namespace Demo.Data.RemoteData.RemoteDataBase
{
public abstract class DesignTimeDbContextFactoryBase<TContext> : IDesignTimeDbContextFactory<TContext> where TContext : DbContext
{
public TContext CreateDbContext(string[] args)
{
var builder = new DbContextOptionsBuilder<TContext>();
2024-11-14 11:24:07 +00:00
builder.UseNpgsql("Host=45.67.56.214;Port=5421;Database=user5;Username=user5;Password=EtEJqhsf");
2024-10-28 12:42:04 +00:00
return CreateNewInstance(builder.Options);
}
protected abstract TContext CreateNewInstance(DbContextOptions<TContext> options);
}
}