-
Notifications
You must be signed in to change notification settings - Fork 351
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
client support for custom uri functions #2631
Conversation
test/FunctionalTests/Microsoft.OData.Client.Tests/DataServiceQueryProviderTests.cs
Outdated
Show resolved
Hide resolved
test/FunctionalTests/Microsoft.OData.Client.Tests/DataServiceQueryProviderTests.cs
Outdated
Show resolved
Hide resolved
test/FunctionalTests/Microsoft.OData.Client.Tests/DataServiceQueryProviderTests.cs
Show resolved
Hide resolved
test/FunctionalTests/Microsoft.OData.Client.Tests/DataServiceQueryProviderTests.cs
Show resolved
Hide resolved
@uffelauesen thanks for this contribution. I'd suggest adding the following information to the description to make it easier to review:
|
Co-authored-by: Clément Habinshuti <haby_habbes@live.com>
@habbes thank you for the review. I have pushed relevant changes to the branch. I have also added some more info to the description - describing more about the Also - I am sorry for the inclusion of the addition changes to #2572 - they are as such not related to the support of (custom) uri functions. Please let me know if you prefer that I pull it out of this PR and create a separate PR for that. Again thanks for the review. |
@uffelauesen Kindly resolve conflicts |
Hi @uffelauesen looks good to me. Kindly resolve the conflicts so we can approve. Thanks. |
Fixed conflicts. |
test/FunctionalTests/Microsoft.OData.Client.Tests/DataServiceQueryProviderTests.cs
Outdated
Show resolved
Hide resolved
test/FunctionalTests/Microsoft.OData.Client.Tests/DataServiceQueryProviderTests.cs
Outdated
Show resolved
Hide resolved
Seems like the branch has conflicts again due to the recent release we made that changed the |
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) |
@uffelauesen There are existing tests that are failing
|
@uffelauesen
|
Issues
This pull request fixes #2630.
Description
A new method attribute UriFunction have been added. Can be used to decorate methods that is to be mapped to a Uri Function.
A boolean property
allowClientSideEvaluation
can be set that will specify if the method can be evaluated client side when all parameters are constants. If this is set to true. then the method is treated like the standard uri functions that will be resolved on the client when all parameters are constants. Setting it to false (default) or leaving it out will force it to be sent to the server regardless if parameters are constant or not.An example of the attribute usage is client support for the standard V4 uri function
now()
. To getnow()
to be output in the query url we will need to decorate a static method with the[UriFunction]
attribute ensuring that we do not specify that it can be evaluated on the client. This way it will be sent to the server even if the normal rules inside theEvaluator
visitor would force it to be evaluated on the client as it has no parameters. A new visitor methodVisitMethodCall
have been added toEvaluator
that will check for theUriFunctionAttribute
and itsAllowClientSideEvaluation
value and bypass client side evaluation (regardless of parameters being constants or not) if it set to false (the default).Checklist (Uncheck if it is not completed)
Additional work necessary
"Docs Needed" - Document the new attribute UriFunctionAttribute.