IssueRaiser

Update model from database

We'll add a new comand (e.g. `Update-DbContext` and `dotnet ef dbcontext update`) to re-scaffold your `DbContext` and entity types to incorporate any changes you've been made to the database schema. This will allow you to update your model to be compatible with the database but preserve any customizations you've made (e.g. navigation property names) to the originally scaffolded code. Scope ===== The folowing types of customizations will be preserved. * Entity type names * Entity type property names (including navigation properties) * Entity type inheritance * DbSet property names The following are not a priority during the initial implementation. * Non-EF annotations on entity type properties (could be enabled via `[MetadataType]`) * Configuration that deviates from the database (database always wins) * Additional constraints added to the model Files will be blindly overwritten during this process. To allow additional customizations to the model, we'll continue generating `partial` classes and reccommend adding custom members to a new file with another partial definition of the class. Implementation ============== We'll leverage the existing Reverse Engineering assets for this work. Specifically: * `IDatabaseModelFactory`--Reads the database schema. * `IScaffoldingModelFactory`--Transforms the schema into a compatible IModel. * `IScaffoldingCodeGenerator`--Transforms the IModel into code. We'll read the current database schema, transform it into a model and compar

Posted by rowanmiller on Oct 8, 2014, 11:16 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.9,000 issues0 comments

github (Other)

Update model from database

rowanmillerOct 8, 2014, 11:16 PM

We'll add a new comand (e.g. `Update-DbContext` and `dotnet ef dbcontext update`) to re-scaffold your `DbContext` and entity types to incorporate any changes you've been made to the database schema. This will allow you to update your model to be compatible with the database but preserve any customizations you've made (e.g. navigation property names) to the originally scaffolded code. Scope ===== The folowing types of customizations will be preserved. * Entity type names * Entity type property names (including navigation properties) * Entity type inheritance * DbSet property names The following are not a priority during the initial implementation. * Non-EF annotations on entity type properties (could be enabled via `[MetadataType]`) * Configuration that deviates from the database (database always wins) * Additional constraints added to the model Files will be blindly overwritten during this process. To allow additional customizations to the model, we'll continue generating `partial` classes and reccommend adding custom members to a new file with another partial definition of the class. Implementation ============== We'll leverage the existing Reverse Engineering assets for this work. Specifically: * `IDatabaseModelFactory`--Reads the database schema. * `IScaffoldingModelFactory`--Transforms the schema into a compatible IModel. * `IScaffoldingCodeGenerator`--Transforms the IModel into code. We'll read the current database schema, transform it into a model and compar

Comments (0)

No comments yet. Start the discussion.

Comment on this issue