First the package Manager console installs the following packages

Install-Package Microsoft.EntityFrameworkCore. Relationl
Copy the code

Install-Package Microsoft.EntityFrameworkCore Install-Package

Microsoft.EntityFrameworkCore.SqlServer Install-Package

Microsoft.EntityFrameworkCore.Tools Install-Package

Microsoft.VisualStudio.Web.CodeGeneration.Design

Execute the following statement in the Package Manager console to generate the entity class

Scaffold-DbContext "Data Source=localhost; Initial Catalog=GFWX; User ID=sa; Password=1" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -Force
Copy the code

instructions

-ContextDir *** Directory where entity files are stored -ContextDir *** directory where DbContext files are stored -Context *** DbContext file name -Schemas *** Schemas where the data table for entity data is to be generated -tables *** Collection of data Tables for generating entity data -DataAnnotations -useDatabasenames Directly uses the table and column names in the database (not supported by some versions) -force to override existing entity files