How to upgrade dbcontext forests in ASP.NET 5 with EF Core?

I have an ASP.NET 5 EF Core (formerly EF 7) Database The first project I'm working on. I was able to restore the contexts of my database using dnx. Access to the database in the project now works well, but I'm wondering how best to reflect the changes when the database schema changes.

First, I migrated the database using the code and updated the contexts using the edmx file, but none of the options apply here.

I can manually edit entity files and add new ones to match database changes. Alternatively, I can erase dbcontext and its table classes each time and re-create from scratch. However, I would prefer a more automated process, if one exists.

+5
source share
1 answer

EntityFramework 7 (soon called Entity Framework Core 1.0) supports both the creation of models from an existing database (Database-First) and the creation of a database from models (Model-First).

For the initial version, it is only planned to create a database from a model and a forest from an existing database. An incremental "database-one" is not planned for the initial version, and it still opens if it does not appear.

However, you can create the database in code, and then use only code and migration for future updates to the database schema.

EDMX ( , -) .

+6

Source: https://habr.com/ru/post/1628892/


All Articles