scaffold-dbcontext 命令的使用

工具的scaffold-dbcontext(数据库上下文脚手架)指令来生成models和context。

指令详细介绍:

Scaffold-DbContext [-Connection] [-Provider] [-OutputDir ] [-Context ]
[-Schemas ] [-Tables ] [-DataAnnotations] [-Force] [-Project ]
[-StartupProject ] [-Environment ] []

PARAMETERS
-Connection
Specifies the connection string of the database.

-Provider
Specifies the provider to use. For example, Microsoft.EntityFrameworkCore.SqlServer.

-OutputDir
Specifies the directory to use to output the classes. If omitted, the top-level project directory is used.

-Context
Specifies the name of the generated DbContext class.

-Schemas
Specifies the schemas for which to generate classes.

-Tables
Specifies the tables for which to generate classes.

-DataAnnotations []
Use DataAnnotation attributes to configure the model where possible. If omitted, the output code will use only the fluent API.

-Force []
Force scaffolding to overwrite existing files. Otherwise, the code will only proceed if no output files would be overwritten.

-Project
Specifies the project to use. If omitted, the default project is used.

-StartupProject
Specifies the startup project to use. If omitted, the solution's startup project is used.

-Environment
Specifies the environment to use. If omitted, "Development" is used.

 

 

示例:

Scaffold-DbContext "Server=.\;Database=MvcMovie;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -Force

Integrated Security(是否集成认证 windows账户认证的意思)

转载于:https://www.cnblogs.com/hzz521/p/9166609.html

你可能感兴趣的:(scaffold-dbcontext 命令的使用)