1、dotnet ef dbcontext scaffold “Server=127.0.0.1;database=TestDb2;uid=sa;pwd=123456;” “Microsoft.EntityFrameworkCore.SqlServer”-o Core
Core是输出到文件夹的意思
2、appsetting.json
{
“ConnectionStrings”: {
“Default”: “Server=127.0.0.1;database=TestDb3;uid=sa;pwd=123456”
},
“Logging”: {
“LogLevel”: {
“Default”: “Information”,
“Microsoft”: “Warning”,
“Microsoft.Hosting.Lifetime”: “Information”
}
},
“AllowedHosts”: “*”
}
3、 services.AddDbContext
