-
Notifications
You must be signed in to change notification settings - Fork 352
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
Implement asynchronous support in ODataJsonLightParameterDeserializer #2311
Implement asynchronous support in ODataJsonLightParameterDeserializer #2311
Conversation
5e2a6f1
to
6603b5e
Compare
public async Task ReadPrimitiveParameterAsync() | ||
{ | ||
var payload = "{\"rating\":4}"; | ||
var setRatingAction = new EdmAction("NS", "SetRating", null); |
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.
nit: Move this closer to usage for consistency.
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.
Fixed
await this.ProcessPropertyAsync( | ||
propertyAndAnnotationCollector, | ||
propertyAnnotationValueReaderAsync, | ||
async (propertyParsingResult, parameterName) => |
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.
A good candidate for a future update on this lambda so it captures less items. 😄
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.
I plan to tackle in a separate to address the same concern in related PRs
08a5656
to
8546f08
Compare
@@ -25,6 +26,11 @@ internal sealed class ODataJsonLightParameterDeserializer : ODataJsonLightProper | |||
private static readonly Func<string, object> propertyAnnotationValueReader = | |||
annotationName => { throw new ODataException(ODataErrorStrings.ODataJsonLightParameterDeserializer_PropertyAnnotationForParameters); }; | |||
|
|||
/// <summary>OData property annotation asynchronous reader for parameter payloads.</summary> |
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.
I don't think this statement is necessary here. Its contradicting the second statement. You can get rid of this and just leave the second one.
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.
Addressed by moving the statement about ODataJsonLightParameterDeserializer
not supporting reading of property annotations to the body of the delegate
8546f08
to
66b8565
Compare
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.
Approved with minor comments
Debug.Assert(propertyAndAnnotationCollector != null, "propertyAndAnnotationCollector != null"); | ||
this.AssertJsonCondition(JsonNodeType.Property, JsonNodeType.EndObject); | ||
|
||
bool parameterRead = false; |
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.
bool parameterRead = false; | |
bool parameterRead = false; | |
|
||
ODataParameterReaderState state; | ||
object parameterValue; | ||
EdmTypeKind parameterTypeKind = parameterTypeReference.TypeKind(); |
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.
EdmTypeKind parameterTypeKind = parameterTypeReference.TypeKind(); | |
EdmTypeKind parameterTypeKind = parameterTypeReference.TypeKind(); | |
switch (parameterTypeKind) | ||
{ | ||
case EdmTypeKind.Primitive: | ||
IEdmPrimitiveTypeReference primitiveTypeReference = parameterTypeReference.AsPrimitive(); |
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.
IEdmPrimitiveTypeReference primitiveTypeReference = parameterTypeReference.AsPrimitive(); | |
IEdmPrimitiveTypeReference primitiveTypeReference = parameterTypeReference.AsPrimitive(); | |
66b8565
to
ce8f2c6
Compare
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
Issues
This pull request partially fulfills #2019.
Description
Implement asynchronous support in
ODataJsonLightParameterDeserializer
.Checklist (Uncheck if it is not completed)
Additional work necessary
If documentation update is needed, please add "Docs Needed" label to the issue and provide details about the required document change in the issue.