【发布时间】:2019-08-21 06:47:00
【问题描述】:
services.AddDbContext<MyContext>(options =>
{
options.UseSqlServer(mysqlConnection,
sqlServerOptionsAction: sqlOptions =>
{
sqlOptions.EnableRetryOnFailure(
maxRetryCount: 10,
maxRetryDelay: TimeSpan.FromSeconds(30),
errorNumbersToAdd: null);
});
});
我在以下位置找到了这段代码 sn-p:
我的数据库是 MySQL 5.7
我把上面的代码改成:
这意味着 EnableRetryOnFailure 不适用于 MySQL 数据库。我现在如何设置重试、延迟等策略?
另外,如果我尝试设置 ExecutionStrategy 功能,我会得到:
然后我尝试使用以下方法创建自己的策略:
public class MyStrategy: ExecutionStrategy
{
......
}
但是现在如何使用这个类呢?
【问题讨论】:
标签: mysql asp.net-core .net-core entity-framework-core