Sundeep
Sundeep

Reputation: 2135

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

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?

Upvotes: 2

Views: 3588

Answers (1)

Todd Skelton
Todd Skelton

Reputation: 7239

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://learn.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.

Upvotes: 1

Related Questions