NuGet Packages
- Microsoft.EntityFrameworkCore.Design
- Shared design-time components for Entity Framework Core tools.

Package Manager Console
- Scaffold-DbContext
- Generates code for a DbContext and entity types for a database.
- In order for Scaffold-DbContext to generate an entity type, the database table must have a primary key.
Scaffold-DbContext "Data Source=(localdb)\MSSQLLocalDB;initial catalog=ContosoPets;Integrated Security=True;ConnectRetryCount=0"
Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -Context CCIPContext -DataAnnotations
- ConnectRetryCount
- The number of times the driver retries connection attempts to the primary database server, and if specified, alternate servers until a successful connection is established.
- This option and the Connection Retry Delay connection option, which specifies the wait interval between attempts, can be used in conjunction with failover.
"ConnectRetryCount=0;"
- -Provider
- The provider to use.
- Typically this is the name of the NuGet package, for example: Microsoft.EntityFrameworkCore.SqlServer.
- This is a positional parameter and is required.
Microsoft.EntityFrameworkCore.SqlServer
- -OutputDir
- The directory to put files in.
- Paths are relative to the project directory.
-OutputDir Models
- -Context
- The name of the DbContext class to generate.
-Context CCIPContext
- -DataAnnotations
- Use attributes to configure the model (where possible). If this parameter is omitted, only the fluent API is used.
-DataAnnotations



Result
