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

entity-framework entity-framework-6

Question

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
0
1/10/2019 10:22:35 PM

Popular Answer

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.

0
1/10/2019 10:29:08 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