Mark Timeout Property as Obsolete and Recommend IHttpClientFactory for Timeout Config #3135
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issues
This pull request fixes #3131.
Description
Summary
This PR marks the
Timeout
property in theDataServiceContext
class as obsolete and recommends usingIHttpClientFactory
to configure the timeout. This change is part of our effort to modernize the configuration of HTTP requests and provide more flexible and robust options for users.Changes
[Obsolete]
attribute to theTimeout
property with a message indicating the deprecation and suggesting the use ofIHttpClientFactory
.Reason for Change
The
Timeout
property is being deprecated to encourage the use ofIHttpClientFactory
, which provides a more flexible and configurable way to manage HTTP client settings, including timeouts. This approach aligns with modern .NET practices and offers better integration with dependency injection and other configuration mechanisms.Impact
Users will see a compiler warning when using the
Timeout
property, indicating that it is obsolete and suggesting the use ofIHttpClientFactory
instead. This change does not break existing code but encourages users to migrate to the new approach.Next Steps
IHttpClientFactory
. Documentation PRTimeout
property in a future major release.Example Usage of IHttpClientFactory
Checklist (Uncheck if it is not completed)
Additional work necessary
Using IHttpClientFactory with Microsoft.OData.Client