[英]Migrate EF6 database-first from SQL Server to PostgreSQL
I am looking for easy way to reuse edmx file created with EF6 over SQL Server to PostgreSQL我正在寻找简单的方法来重用使用 EF6 通过 SQL Server 创建的 edmx 文件到 PostgreSQL
I have used database-first with EF6 on SQL Server and everything worked fine.我在 SQL Server 上使用了数据库优先和 EF6,一切正常。 We are going to use PostgreSQL.我们将使用 PostgreSQL。 I have already migrated the database to PostgreSQL, and installed EntityFramework6.Npgsql, and I wanted use database-first approach again.我已经将数据库迁移到 PostgreSQL,并安装了 EntityFramework6.Npgsql,我想再次使用数据库优先的方法。
I tried to update from database but it looks that I have to fix all the edmx file.我试图从数据库更新,但看起来我必须修复所有 edmx 文件。 The original entity model is quite complex, with abstract class, complex types and enum types.原始实体模型相当复杂,有抽象类、复杂类型和枚举类型。 The new edmx file lost inheritance and complex types.新的 edmx 文件失去了继承性和复杂类型。
Do you know an easy way to do it?你知道一个简单的方法吗?
I don't know if you can get the EDMX file to work with PostgreSQL, but you might be able to use scaffolding and get a db first approach.我不知道您是否可以让 EDMX 文件与 PostgreSQL 一起使用,但您也许可以使用脚手架并获得 db first 方法。 Something like:就像是:
dotnet ef dbcontext scaffold dotnet ef dbcontext 脚手架
This would allow you to make changes in the database and have them reflected in code.这将允许您在数据库中进行更改并将它们反映在代码中。 I'm no PostgreSql expert but this article sure makes it look like it's possible.我不是 PostgreSql 专家,但这篇文章确实让它看起来是可能的。
If you want a more graphical approach then you may want to consider switching to code first and using the class designer in visual studio.如果您想要更图形化的方法,那么您可能需要考虑首先切换到代码并使用 Visual Studio 中的类设计器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.