Entity Framework 6 DB First approach with no EDMX. Is it possible?

Viewed 2190

EDMX is very cumbersome to use after certain DB complexity. We are at a point where we want to get rid of it but still we want to update DB first and get the model changes. Is it possible?

1 Answers

Yes, as long as your code-first model matches your database. It will map correctly without a need for an EDMX, but this will mean you have to manually update your models or regenerate your code-first files.

More info can be found here: https://docs.microsoft.com/en-us/ef/ef6/modeling/code-first/workflows/existing-database

Another option is to use entity framework migrations. Instead of letting EF apply the migration, use Update-Database -Script and this will generate a sql script to apply it manually. This wouldn't be db first, but you could make changes to the script before applying.

Related