TIL

Today I Learned


Project maintained by gushwell Hosted on GitHub Pages — Theme by mattgraham

EF Coreで、SQLのコマンドタイムアウト値を設定する

program.csで以下のように記述する.

var connectionString = builder.Configuration.GetConnectionString("MyDbContext");
builder.Services.AddDbContext<AppDbContext>(options =>
    options.UseSqlServer(connectionString,
                         sqlServerOptions => sqlServerOptions.CommandTimeout(90))
    );

CommandTimeoutの引数は、秒を指定する。