-
-
Notifications
You must be signed in to change notification settings - Fork 803
[Docs] Update v16 migration guide #9123
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -178,6 +178,39 @@ public class CustomRequestMiddleware | |||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| ## OperationResultBuilder is now internal | ||||||
|
|
||||||
| If you've previously used the `OperationResultBuilder` to construct an `OperationResult`, switch to constructing it directly instead: | ||||||
|
|
||||||
| ```csharp | ||||||
| var errors = ImmutableList.Create<IError>([]); | ||||||
| var extensions = ImmutableOrderedDictionary.Create([]); | ||||||
|
|
||||||
| context.Result = new OperationResult(errors, extensions); | ||||||
| ``` | ||||||
|
Comment on lines
+185
to
+190
|
||||||
|
|
||||||
| If you've used `OperationResultBuilder.FromResult()` to alter an existing `OperationResult`, switch to directly modifying the `OperationResult`: | ||||||
|
|
||||||
| ```diff | ||||||
| if (context.Result is OperationResult result) | ||||||
| { | ||||||
| - var resultBuilder = OperationResultBuilder.FromResult(result); | ||||||
| - resultBuilder.SetExtension("foo", "bar"); | ||||||
| - context.Result = resultBuilder.Build(); | ||||||
| + result.Extensions = result.Extensions.SetItem("foo", "bar"); | ||||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| Most of the properties you'd want to modify are now immutable data structures that can be modified. | ||||||
|
||||||
| Most of the properties you'd want to modify are now immutable data structures that can be modified. | |
| Most of the properties you'd want to change now expose immutable collection types; use their non-destructive update methods (for example, `SetItem` returns a new instance) and assign the returned value back to the property. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ImmutableOrderedDictionary.Create([])will not compile as written because the generic type arguments cannot be inferred from an empty collection expression. UseImmutableOrderedDictionary<string, object?>.Emptyor specify the generic arguments explicitly (e.g.,Create<string, object?>(...)).