{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;database=typecho;uid=root;pwd=woshishui;"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}
? services.AddDbContext<typechoContext>(options=>options.UseMySql(Configuration.GetConnectionString("DefaultConnection")));
// other service configurations go here
// replace "YourDbContext" with the class name of your DbContext
services.AddDbContextPool<typechoContext>(options => options
// // replace with your connection string .UseMySql("Server=localhost;Database=typecho;User=root;Password=woshishui;", mySqlOptions => mySqlOptions
// // replace with your Server Version and Type
.ServerVersion(new ServerVersion(new Version(8, 0, 19), ServerType.MySql))
// ));
原文:https://www.cnblogs.com/ouyangkai/p/12795695.html