Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate out RequestOptions from RequestContext #25594

Closed
wants to merge 9 commits into from

Conversation

annelo-msft
Copy link
Member

This is so RequestOptions can be used by Gen 1 Generated Clients and not have ambiguity in the method signature regarding which CancellationToken takes precedence, whether two CTs are joined, etc.

Fixes Azure/autorest.csharp#1666

@ghost ghost added the Azure.Core label Dec 1, 2021
@azure-sdk
Copy link
Collaborator

API changes have been detected in Azure.Core. You can review API changes here

@annelo-msft annelo-msft marked this pull request as ready for review December 1, 2021 18:10
@pakrym
Copy link
Contributor

pakrym commented Dec 1, 2021

@KrzysztofCwalina @tg-msft I feel that confusion created by having two very similar "context" types is way larger than confusion created by having 2 places to set cancellation tokens.

I prefer option 3 from Azure/azure-sdk#3391. It doesn't require a new type just to solve a few corner cases.

@annelo-msft annelo-msft requested a review from ellismg December 1, 2021 18:57
@azure-sdk
Copy link
Collaborator

API changes have been detected in Azure.Core. You can review API changes here

API changes

+     public class RequestOptions {
+         public RequestOptions();
+         public ErrorOptions ErrorOptions { get; set; }
+         public void AddPolicy(HttpPipelinePolicy policy, HttpPipelinePosition position);
+     }
-     public class RequestContext {
+     public class RequestContext : RequestOptions {
-         public ErrorOptions ErrorOptions { get; set; }
-         public void AddPolicy(HttpPipelinePolicy policy, HttpPipelinePosition position);

@azure-sdk
Copy link
Collaborator

API changes have been detected in Azure.Core. You can review API changes here

API changes

+     public class RequestOptions {
+         public RequestOptions();
+         public ErrorOptions ErrorOptions { get; set; }
+         public void AddPolicy(HttpPipelinePolicy policy, HttpPipelinePosition position);
+     }
-     public class RequestContext {
+     public class RequestContext : RequestOptions {
-         public ErrorOptions ErrorOptions { get; set; }
-         public void AddPolicy(HttpPipelinePolicy policy, HttpPipelinePosition position);

@annelo-msft
Copy link
Member Author

We will introduce RequestOptions in Core.Experimental to work out details around the use of RO in HLC APIs prior to putting it into Core.

@annelo-msft annelo-msft reopened this Feb 9, 2022
@check-enforcer
Copy link

check-enforcer bot commented Feb 9, 2022

This pull request is protected by Check Enforcer.
For more information about how to run a pipeline against this pull request, see this.

@annelo-msft annelo-msft marked this pull request as draft February 9, 2022 12:48
@annelo-msft
Copy link
Member Author

Closing in favor of: #27149

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[LLC] Move RequestOptions into Core
4 participants