我根据你的文章 Net8 EFCore Mysql 连接
//注意:在动态对EntityFrameworkCore中间件进行实例化时,必须使用“AddDbContextPool” 内置方法替换“AddDbContext”内置方法,
//否则就会出现异常:“System.InvalidOperationException: The service collection cannot be modified because it is read-only”
我把AddDbContext改为AddDbContextPool 还是这个错误 请问怎么解决
builder.Services.AddDbContextPool<SqlContext>(options =>
{
var serverVersion = ServerVersion.AutoDetect(sqlConnection); //mysql版本: {8.2.0-mysql}
options.UseMySql(sqlConnection, serverVersion);
});