dotnet / dotnet/EntityFramework.Docs

Document keeping EF Core models In sync when changing both the model and the database (Hybrid approach)

Open
#3,540 3 comments 1 reaction 0 assignees View on GitHub
area-model-building new-pm
Dominant language
Mermaid
Stars
1.7k
Forks
2k
Avg merge
7d 23h
Merged PRs (30d)
16

Description

We are trying to use EF Core - Database First. We understand the advantages of code first but have compliance requirements that make database first right for us. We have many questions, requests:

**Keeping EF Core In Sync**
What does it mean exactly to keep the EF Core model in sync with the database? What parts of the Fluent API or attributes are for "migrations" and what parts are for "synchronization"? Do constraint name have to match? Does Delete behavior matter? Indexes? Where is the actual line between the migration feature that is bundled (no pun intended) with EF Core and the core ORM?

**Validating Sync Status**
Assuming we figure out the above question and are willing and able to do all the work of keeping things in sync. It should be possible to validate via integration tests that an EF Core model matches a database...at least for the ORM feature.

**Documentation**
Please, please add more documentation about Database First. It should be a well documented option.

**API**
Please make it easy to use the ORM parts of EF Core without running into migrations. The API surface area (fluent or otherwise) should make clear what features are for migrations and what features are for the ORM.

"Sync Validation"
Please add APIs to validate whether or not an EF Core model is in sync with a database.

**Documentation**
Please document the database first approach properly. Tradeoffs, effort required, limitations etc. Please document what is required to keep an EF Core model in sync.

EF Core is a very nice ORM and the migration feature is great as well. Please don't make it an all or nothing proposition.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.