Migrate EF6 database-first from SQL Server to PostgreSQL

c# ef-database-first entity-framework-6 postgresql sql-server

Question

I am looking for easy way to reuse edmx file created with EF6 over SQL Server to PostgreSQL

I have used database-first with EF6 on SQL Server and everything worked fine. We are going to use PostgreSQL. I have already migrated the database to PostgreSQL, and installed EntityFramework6.Npgsql, and I wanted use database-first approach again.

I tried to update from database but it looks that I have to fix all the edmx file. The original entity model is quite complex, with abstract class, complex types and enum types. The new edmx file lost inheritance and complex types.

Do you know an easy way to do it?

1
1
1/3/2019 8:20:32 AM

Popular Answer

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. Something like:

dotnet ef dbcontext scaffold

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.

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.

0
2/13/2019 2:17:00 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow