dotnet core EF命令

dotnet 3.1 之后,需要升级 dotnet ef命令

dotnet tool install --global dotnet-ef


命令使用帮助
dotnet ef dbcontext scaffold -h

Arguments:
参数:
The connection string to the database.
数据库连接字符串
The provider to use. (E.g. Microsoft.EntityFrameworkCore.SqlServer)
提供程序类型

Options:
其他选项:
-d|–data-annotations Use attributes to configure the model (where possible). If omitted, only the fluent API is used.
数据注释使用属性来配置模型(如果可能)。如果省略,则只使用fluent API。

-c|–context The name of the DbContext.
DbContext 的名称

–context-dir The directory to put DbContext file in. Paths are relative to the project directory.
DbContext 的路径

-f|–force Overwrite existing files.
覆盖已经存在的文件

-o|–output-dir The directory to put files in. Paths are relative to the project directory.
输出目录

–schema <SCHEMA_NAME>… The schemas of tables to generate entity types for.
要为其生成实体类型的表的架构。

-t|–table <TABLE_NAME>… The tables to generate entity types for.
要生成实体代码的表的名称 支持视图名称
多个table用多个-t

–use-database-names Use table and column names directly from the database.
使用数据库名称

–json Show JSON output.
输出内容,以json显示

-p|–project The project to use.
项目名称

-s|–startup-project The startup project to use.
开始项目名称(不太明白)

–framework The target framework.
framework的版本

–configuration The configuration to use.
配置信息

–runtime <RUNTIME_IDENTIFIER> The runtime to use.
运行版本(??)

–msbuildprojectextensionspath The MSBuild project extensions path. Defaults to “obj”.
–no-build Don’t build the project. Only use this when the build is up-to-date.
-h|–help Show help information
-v|–verbose Show verbose output.
–no-color Don’t colorize output.
–prefix-output Prefix output with level.

sql server---------------------------------------------------------------
dotnet ef dbcontext scaffold “Server=(local);Database=lun;User ID=sa;Password=;” Microsoft.EntityFrameworkCore.SqlServer -o models -c Lun_DbContext

my sql---------------------------------------------------------------
Scaffold-DbContext “server=127.0.0.1;uid=root;pwd=1234123;database=shop” Pomelo.EntityFrameworkCore.Mysql -f -o Shop/Models

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yangxinyue315

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值