-
Notifications
You must be signed in to change notification settings - Fork 349
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
Allow $filtering with enum integer value in squote and without squote #3014
Conversation
…ability to convert integral value to enum member name
src/Microsoft.OData.Core/UriParser/Binders/MetadataBindingUtils.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.OData.Core/UriParser/Binders/MetadataBindingUtils.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.OData.Core/UriParser/Binders/MetadataBindingUtils.cs
Outdated
Show resolved
Hide resolved
test/FunctionalTests/Microsoft.OData.Core.Tests/UriParser/Binders/MetadataBindingUtilsTests.cs
Outdated
Show resolved
Hide resolved
test/FunctionalTests/Microsoft.OData.Core.Tests/UriParser/Binders/MetadataBindingUtilsTests.cs
Outdated
Show resolved
Hide resolved
var enumMember = enumType.Members.FirstOrDefault(m => m.Value.Value == memberIntegralValue); | ||
if (enumMember != null) | ||
{ | ||
string literalText = ODataUriUtils.ConvertToUriLiteral(enumMember.Name, default(ODataVersion)); |
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.
Is it possible to use the version from configuration?
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.
Donot we need to change 'EnumAsStringUriResolver'?
…and adds more tests to handle float, long and int.
src/Microsoft.OData.Core/UriParser/Binders/MetadataBindingUtils.cs
Outdated
Show resolved
Hide resolved
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.
LGTM
…#3014) * Allow comparison with underlying integral for Enum member and add capability to convert integral value to enum member name * Bump with tests * Move helper methods to EnumHelper, use them to check for enum values and adds more tests to handle float, long and int. * Use explicit/exact type instead of 'var' * Add more tests to handle huge, long values * Add assertion for comparing enum member name with the result * Move extension methods from Edm EnumHelper.cs to Core in EdmExtensionMethods.cs
…nteger value in squote and without squote (#3018) * Support Enums as Keys in OData Client (#3013) * Checkout from 'main' * Add and modify test cases * Only allow nullable Generic Type Enum * Adding a test that throws Exception if key is nullable generic type with struct as generic argument * Adding a test to mock querying data with enum as keys * Add a test to select single entity * Add test to filter by enum member name and a test to use ByKey to filter by composite keys * Add a test to filter by enum key only using ByKey() * Allow $filtering with enum integer value in squote and without squote (#3014) * Allow comparison with underlying integral for Enum member and add capability to convert integral value to enum member name * Bump with tests * Move helper methods to EnumHelper, use them to check for enum values and adds more tests to handle float, long and int. * Use explicit/exact type instead of 'var' * Add more tests to handle huge, long values * Add assertion for comparing enum member name with the result * Move extension methods from Edm EnumHelper.cs to Core in EdmExtensionMethods.cs
Issues
This pull request fixes #2542.
Description
This change is to allow
$filter
usingenum
integer
value
.For example, to allow:
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.