-
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
Provide option for alternative form of delete link request Uri #2209
Provide option for alternative form of delete link request Uri #2209
Conversation
75cc304
to
89a5ff4
Compare
89a5ff4
to
94b6444
Compare
{ | ||
// Related key segment should appear before /$ref | ||
int indexOfLinkSegment = uriString.IndexOf(XmlConstants.UriLinkSegment, StringComparison.Ordinal); | ||
builder.Append(indexOfLinkSegment > 0 ? uriString.Substring(0, indexOfLinkSegment - 1) : uriString); |
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.
why not >= 0
since 0 can be a valid index?
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.
Maybe we can use Span
and slice the string to avoid allocation with Substring
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.
@habbes Using >= 0
would suggest that uriString
starts with $ref
which is not practical in this case. So while we can make that change, it's really not a practical scenario
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.
@habbes Span
(and ReadOnlySpan
) are not available in NET45 but we could introduce the System.Memory
package to take care of that. Maybe to keep the change small we could live with that single extra allocation since this code is not on a hot path
/// <summary> | ||
/// Used to specify the form of Uri to be used for a delete link request. | ||
/// </summary> | ||
public enum DeleteLinkUriOption |
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.
Out of curiosity, does this issue with different URI options only affect DELETE requests?
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.
It only affects DELETE requests
/// Pass the id of the related entity as a query param, i.e., | ||
/// {ServiceUri}/{EntitySet}/{Key}/{NavigationProperty}/$ref?$id={ServiceUri}/{RelatedEntitySet}/{RelatedKey} | ||
/// </summary> | ||
DollarIdQueryParam = 0, |
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'd suggest the name to be IdQueryParam
. In case we have situtations where the $
is optional.
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.
$
sign is only optional in system query options e.g select, top, expand etc
/// Pass the id of the related entity as a query param, i.e., | ||
/// {ServiceUri}/{EntitySet}/{Key}/{NavigationProperty}/$ref?$id={ServiceUri}/{RelatedEntitySet}/{RelatedKey} | ||
/// </summary> | ||
DollarIdQueryParam = 0, |
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.
$
sign is only optional in system query options e.g select, top, expand etc
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.
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.
Please create an issue to consider changing the default in the next breaking change release.
94b6444
to
f43ea3a
Compare
f43ea3a
to
b0cf008
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 fixes #2201.
Description
Provide option for form of delete link request Uri.
According to the OData spec, a delete link request should have a Uri like:
But in V3 and V4.01, the following alternative form is supported:
Checklist (Uncheck if it is not completed)