EF Core dotnet-ef 常用命令,指令


一、当前安装dotnet-ef 版本查看

dotnet-ef --version

二、dotnet-ef 所有版本查看

版本查看地址:https://www.nuget.org/packages/dotnet-ef

三、dotnet-ef 版本切换

dotnet tool uninstall --global dotnet-ef
dotnet tool install --global dotnet-ef --version 5.0.0

四、dotnet-ef 模型更新

1) 生成所有表模型

dotnet ef dbcontext scaffold "Server = ***;Database = YESDotnet;User ID = garson;Password =***;Trusted_Connection = False" Microsoft.EntityFrameworkCore.SqlServer --output-dir "Tables" --no-onconfiguring --no-pluralize --use-database-names --force --data-annotations --context-dir "Entities" --context-namespace "YESWEB.Module.DengSystemDB"  --context "_EntitiesContext"

2) 生成指定表模型

dotnet ef dbcontext scaffold "Server = ***;Database = YESDotnet;User ID = garson;Password =***;Trusted_Connection = False" Microsoft.EntityFrameworkCore.SqlServer --output-dir "Tables" --table "dt_data1" --table "dt_data2" --table "dt_data3" --no-onconfiguring --no-pluralize --use-database-names --force --data-annotations --context-dir "Entities" --context-namespace "YESWEB.Module.DengSystemDB"  --context "_EntitiesContext"

 

五、dotnet-ef 生成数据库迁移脚本

dotnet ef migrations add V001 --context EntitiesContext --project "..\YESWEB.Module.DengSystemDB" --startup-project "..\_DBContextScaffold.Start"

 

六、配置数据库连接机密,机密管理

初始化机密配置

dotnet user-secrets init

配置机密 数据库连接字符串

dotnet user-secrets set ConnectionStrings.GZSales "Data Source=***;User Id=***;Password=***;Initial Catalog=GZSales"

 

版权声明:本文为YES开发框架网发布内容,转载请附上原文出处连接
YES开发框架
上一篇:EF Code First
下一篇:EF Core dotnet-ef 常用命令,指令
评论列表

发表评论

评论内容
昵称:
关联文章

PVE硬盘对应SATA口查询

联系我们
联系电话:15090125178(微信同号)
电子邮箱:garson_zhang@163.com
站长微信二维码
微信二维码