.net core DBFirst 生成Model表结构
参考:
https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/powershell
https://docs.microsoft.com/zh-cn/ef/core/managing-schemas/scaffolding?tabs=dotnet-core-cli
程序包控制台,需要满足项目可编译的条件下才能使用
Scaffold-DbContext -Connection "Server=***;Database=***;uid=***;pwd=***" Microsoft.EntityFrameworkCore.SqlServer -OutputDir "Tables" -UseDatabaseNames -Force -DataAnnotations -Context "_EntitiesContext" -Project "GZImageSearch.Model" -StartupProject "GZImageSearch.Model"
在Model模块下运行命令行
dotnet ef dbcontext scaffold "Server=***;Database=***;uid=***;pwd=***" Microsoft.EntityFrameworkCore.SqlServer --output-dir "Tables" --use-database-names --force --data-annotations --context "_EntitiesContext"
慎于行,敏于思!GGGGGG