Add TimeSpan timeouts
- Dominant language
- C#
- Stars
- 989
- Forks
- 340
- Avg merge
- 4d 18h
- Merged PRs (30d)
- 69
Description
In https://github.com/dotnet/runtime some new apis were approved, https://github.com/dotnet/runtime/issues/14336 , to add TimeSpan timeouts in the BCL where it was appropriate and some of those locations were in SqlClient, SqlClient in the BCL is now in maintenance mode but we can implement those new apis in this library.
Having to use second or millisecond int timeouts has always been a source of bugs and having timeouts be more naturally expressible will feel cleaner for very little cost.
The approved apis that apply to this library were:
```diff
namespace System.Data.Sql {
public sealed class SqlNotificationRequest {
+ public TimeSpan TimeoutTimeSpan { get; set; }
}
}
namespace System.Data.SqlClient {
public sealed class SqlBulkCopy {
+ public TimeSpan BulkCopyTimeoutTimeSpan { get; set; }
}
public sealed class SqlConnectionStringBuilder {
+ public TimeSpan ConnectTimeoutTimeSpan { get; set; }
+ public TimeSpan LoadBalanceTimeoutTimeSpan { get; set; }
+ public TimeSpan CommandTimeoutTimeSpan { get; set; }
}
public sealed class SqlDependency {
+ public SqlDependency(SqlCommand command, string options, TimeSpan timeout);
}
}
```
We should also consider adding something to SqlCommand to cover this part:
```diff
namespace System.Data {
! This would need to be a DIM.
public interface IDbCommand {
+ TimeSpan CommandTimeoutTimeSpan { get; set; }
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.