This article is a mirror article of machine translation, please click here to jump to the original article.

View: 17982|Reply: 0

[.NET Core] Instructions for using EF Core's Scaffold-DbContext scaffolding command

[Copy link]
Posted on 2/8/2019 1:39:35 PM | | |
The tool's scaffold-dbcontext directive to generate models and contexts.

Instruction details:

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

PARAMETERS
-Connection <String>
Specifies the connection string for the database.

-Provider <String>
Specify the provider to use. For example, Microsoft.EntityFrameworkCore.SqlServer.

-OutputDir <String>
Specify the directory used for the output class. If omitted, the top-level item directory is used.

-Context <String>
Specifies the name of the generated DbContext class.

-Schemas <String>
Specify the schema for which you want to generate the class.

-Tables <String>
Specify the table for which you want to generate the class.

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

-Force [<SwitchParameter>]
Force scaffolding to overwrite existing files. Otherwise, the code will only continue if no output file is overwritten.

-Project <String>
Specify the items to use. If omitted, the default project is used.

-StartupProject <String>
Specify the launch project to use. If omitted, use the solution's startup project.

-Environment <String>
Specify the environment to use. If omitted, "Develop" is used.



Example:






Previous:【Jiangshi WeChat Multi-Open】WeChat Scan Code Optional Login|Unlimited Multi-Open|Save Login Configuration
Next:The MVC schema reads the post table post ID and title of Discuz's MySQL database
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com