I register DbContext
using Dependency Injection, where I use connection string and CommandTimeout(600)
option.
But when I use the sqlServerOption
having command timeout set, it is not working. In resolved context I always receive timeout used in connection string (or default if not specified in connection string).
I don't want to set timeout via connection string for some reasons. What's wrong there please? I found question How to set CommandTimeout for DbContext?, but solved differently.
services.AddDbContext<MyDbContext>(
options => options.UseSqlServer(
"someConnectionString",
sqlServerOptions => sqlServerOptions.CommandTimeout(600))); //600s