//创建目录:mkdir EFCoreScaffoldexample
//进入目录:cd EFCoreScaffoldExample
//创建控制台项目:dotnet new console
//添加依赖:dotnet add package Microsoft.EntityFrameworkCore.SqlServer --version 7.0.15
//添加依赖:dotnet add package Microsoft.EntityFrameworkCore.Design --version 7.0.15
//测试是否可以使用 ef 命令:dotnet ef -h
//安装 Microsoft.EntityFrameworkCore.Design
//dotnet add package Microsoft.EntityFrameworkCore.Design --version 7.0.15
//安装 EF 工具
//dotnet tool install --global dotnet-ef --version 7.0.15
//Update-Database -Verbose
//数据库生成Models
// Fluent API 配置:https://www.learnentityframeworkcore.com/configuration/fluent-api
//dotnet ef dbcontext scaffold "Server=127.0.0.1;database=microdb;uid=sa;pwd=.mssql.;TrustServerCertificate=True;" Microsoft.EntityFrameworkCore.SqlServer -o Models
//Data Annotations 配置:https://www.learnentityframeworkcore.com/configuration/data-annotation-attributes
//dotnet ef dbcontext scaffold "Server=127.0.0.1;database=microdb;uid=sa;pwd=.mssql.;TrustServerCertificate=True;" Microsoft.EntityFrameworkCore.SqlServer -d Models
//数据库架构更改后重新构建模型
//dotnet ef dbcontext scaffold "Server=127.0.0.1;database=microdb;uid=sa;pwd=.mssql.;TrustServerCertificate=True;" Microsoft.EntityFrameworkCore.SqlServer --force