efcore6反向工程
作者:互联网
依赖:
命令行:
Scaffold-DbContext 'Data Source=IP地址;Initial Catalog=数据库名称;uid=账号;pwd=密码' Microsoft.EntityFrameworkCore.SqlServer -ContextDir Data -OutputDir Models
Program.cs添加
//添加EFCORE上下文
builder.Services.AddDbContext<HyDbContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("HyDb"))
);
//配置连接字符串
{
"ConnectionStrings": {
"HyDb": "Data Source=IP地址;Initial Catalog=数据库名;uid=账号;pwd=密码"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
标签:efcore6,uid,工程,Initial,Source,Catalog,反向,IP地址,Data 来源: https://www.cnblogs.com/xlsh/p/16359631.html