Updating the model from database

Since we are building the application using a "database first" approach, let's first update the application model classes from the database. As in Chapter 3, Setting Up the Development Environment, we will use a scaffolding command, for which we will perform the following steps:

  1. Open the TextScoreDashboard project in Visual Studio.
  2. Navigate to Tools -> Nuget Package Manager -> Package Manager Console.
  3. Run the following command.

You will notice the -Force flag. This flag is needed to force the regeneration of the model classes from the database, replacing the existing classes we've generated previously.

The command is provided below:

        Scaffold-DbContext "<database connection string>"    Microsoft.EntityFrameworkCore.SqlServer ...

Get Serverless computing in Azure with .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.