简体   繁体   English

将 EF6 数据库优先从 SQL Server 迁移到 PostgreSQL

[英]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.

相关问题 实体框架数据库优先-SQL Server - Entity Framework database-first with SQL Server EF6 数据库优先:违反多重性约束。 关系“...”的角色“...”具有多重性 1 或 0..1 - EF6 Database-First: Multiplicity constraint violated. The role '…' of the relationship '…' has multiplicity 1 or 0..1 如何在 EF6 Database-First 中为所有实体类拥有一个未映射的公共抽象 BaseEntity 父级? - How to have a not mapped, common abstract BaseEntity parent for all entity class in EF6 Database-First? EF6 PostgreSQL数据库优先,无法生成模型 - EF6 postgresql database first, can't generate model EF迁移数据库优先方法? - EF Migrations for Database-first approach? SQL Server到.Net Decimals与EF6 dDatabase的第一个问题 - SQL Server to .Net Decimals with EF6 dDatabase first issue 数据库优先EF dnx ef dbcontext scaffold命令失败 - Database-first EF dnx ef dbcontext scaffold command fails 从“代码优先自数据库” EF6更改生成的类 - Changing the generated classes from “Code First From Database” EF6 从基于SQL Server的代码优先EF迁移到SQLite EF - Migrate from SQL Server-based code-first EF to SQLite EF 带有SQL Server和MYSQL的EF6,数据库中的数据类型不匹配 - EF6 with SQL Server and MYSQL, with mismatch datatype in database
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM