Create the Scaffold movie pages
Use the scaffolding tool to produce Create, Read, Update, and Delete (CRUD) pages for the movie model.
Open a command window in the project directory. The project directory is the directory that contains the Program.cs and .csproj files.
Run the following command:
dotnet-aspnet-codegenerator controller -name MoviesController -m Movie -dc MvcMovieContext --relativeFolderPath Controllers --useDefaultLayout --referenceScriptLibraries -sqlite
The following table details the ASP.NET Core code generator parameters:
The relative output folder path to create the files.
The default layout should be used for the views.
--referenceScriptLibraries
Adds _ValidationScriptsPartial to Edit and Create pages.
Flag to specify if DbContext should use SQLite instead of SQL Server.
Eliminate Warning for nullable.
To eliminate the warnings from nullable reference types, remove the following line from the MvcMovie.csproj file:
<Nullable>enable</Nullable>
Initial migration
Step 1: If dotnet ef has not been installed, install it as a global tool:
For more information on the CLI for EF Core, see EF Core tools reference for .Net CLI.
Step 2: Run the following .NET CLI commands:
Run the app and select the Movie App link.
If you get an exception similar to the following, you may have missed the above Migration Step