It's still not clear how to filter by enum property #1202
Unanswered
TooMuchLagWillKillYou
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I know that in previous versions of OData we could filter a collection using the numeric representation of an enum, like in this example:
But now this seems to be impossible to do since I get this error:
I have been looking for documentation on the topic for the past two days and couldn't find a single line of code that was helpful.
My scenario is this: I have migrated a large web application from .NET Framework 4.7 to .NET 6 with the front end being developed with React. Many sections of this application query a list filtered by a "Status" property which is of type enum.
I know that if I could pass the string representation of the enum it would work but this requires editing a lot of components and I cannot do it.
I tried implementing
StringAsEnumResolver
, but that didn't change a thing. I have also tried to implement aCustomStringAsEnumResolver
because I noticed that the methodPromoteBinaryOperandTypes()
doesn't care if one of the operands is an enum, but the debugger doesn't even hit the breakpoint I put in this class.How can we solve or workaround this?
Beta Was this translation helpful? Give feedback.
All reactions