【发布时间】:2020-04-27 01:20:09
【问题描述】:
我正在阅读through the documentation on connection resiliency in Entity Framework Core 并了解到可以在配置服务时在 ASP.NET Core 中配置连接弹性:
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<PicnicContext>(
options => options.UseSqlServer(
"<connection string>",
providerOptions => providerOptions.EnableRetryOnFailure()));
}
我注意到对于其他服务,例如 Azure 搜索客户端,默认启用重试机制。 Entity Framework Core (3.1.3) 也是这种情况,还是我需要显式调用providerOptions => providerOptions.EnableRetryOnFailure()?
SqlServerDbContextOptionsBuilder documentation 没有提供有关默认值的详细信息。
【问题讨论】:
标签: asp.net-core entity-framework-core