【发布时间】:2019-03-23 06:31:35
【问题描述】:
我创建了一个项目,我想在其中连接到 SQLite 提供程序以进行测试,并在生产环境中使用 PostgreSQL。
protected override void OnConfiguring(DbContextOptionsBuilder opt)
{
#if DEBUG
opt.UseSqlite("Data Source=blogging.db");
#endif
#if !DEBUG
opt.UseNpgsql("Host=localhost;Database=xxxx;Username=xxxxx;Password=xxxxx");
#endif
}
我想使用代码优先策略。对于 SQLite - 没问题:
dotnet ef migrations add InitialCreate
dotnet ef database update
总之,PostgeSQL(开源)有类似的解决方案吗?
【问题讨论】:
标签: postgresql .net-core entity-framework-6 entity-framework-core asp.net-core-2.1