Mark Timeout Property as Obsolete and Recommend IHttpClientFactory for Timeout Config#3135
Merged
WanjohiSammy merged 3 commits intomainfrom Nov 29, 2024
Merged
Conversation
gathogojr
approved these changes
Nov 27, 2024
2 tasks
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Timeoutproperty in theDataServiceContextclass as obsolete and recommends usingIHttpClientFactoryto 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 theTimeoutproperty with a message indicating the deprecation and suggesting the use ofIHttpClientFactory.Reason for Change
The
Timeoutproperty 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
Timeoutproperty, indicating that it is obsolete and suggesting the use ofIHttpClientFactoryinstead. This change does not break existing code but encourages users to migrate to the new approach.Next Steps
IHttpClientFactory. Documentation PRTimeoutproperty 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