dotnet / efcore

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
https://docs.microsoft.com/ef/
MIT License
13.82k stars 3.2k forks source link

Provider-agnostic timeouts #18456

Open ajcvickers opened 5 years ago

ajcvickers commented 5 years ago

The idea here is to have a core-level API to set a "database access timeout". Every provider would then use the value set to configure appropriate timeouts in the lower-level APIs that the provider uses. For example, a relational provider would use this to set both command and connection timeouts.

Any call to a more provider-specific API would override anything set here.

This has two advantages:

sputier commented 5 years ago

As a first step into the EF Core source, I'm trying to think about a way to solve this issue. So far, I thought about adding a DbContextOptionsBuilder.SetDatabaseAccessTimeout method, which would set a CoreOptionsExtension value. Could this be a good start to handle this issue ?

AndriySvyryd commented 5 years ago

@sputier That sounds reasonable, you can also open a WIP/draft PR if you aren't sure about what needs to be done next. Don't forget to add tests for different providers.