This tutorial shows you how to Add a new Field in the ASP.NET Core application. We will use Entity Framework Code First Migrations to add a new field in the model and change it in the database.
When you use EF Code First to automatically create a database, Code First adds a table to the database to help the database be synchronized with the generated model classes. If it is not synchronized EF will give an exception. This makes it easier to keep track of development issues that you usually find only at the time of running.
For example, we will add a Rating property to Model Movie
You must update the controller because you have just added a new filed in the Movie class, so you also need to update it to your binding list. Simply put, you only need to update the [Bind] property in the Create and Edit methods, then add your Rating property.
Next, Update filed to your view, then update your database
Build the application and if you prefer to use the command prompt, enter the following commands:
dotnet ef migrations add Rating dotnet ef database update
If you use Console in Visual you can enter
Add-Migration Rating Update-Database