Entity Framework Element Code First File Migration File

I wanted to ask about it directly, because I can not find the answer there.

When I run "Add-Migration ...", new file migration files (.cs, .resx, .Designer.cs) are created. As for version control, what files should I execute for my repo and which files can I ignore? I'm only interested in the files needed to restore my tables, if necessary.

+5
source share
1 answer

When I run "Add-Migration ...", new file migration files (.cs, .resx, .Designer.cs) are created. As for source control, which files should I transfer my repo and which files can I ignore?

All 3 files are needed to restore your database.

  • The .cs file contains the Up and Down methods to help you upgrade or downgrade your database, respectively.
  • The .resx contains metadata used by migrations. It contains the name of the default schema (dbo is the default) and a snapshot of the model during migration creation.
  • .Designer.cs here due to the presence of .resx . It contains properties that make it easy to access settings in a .resx file.

All 3 files should be fixed and placed in your control source, and no one should edit them.

+4
source

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


All Articles