Translate ToString() over enums
Fixes #33635 and #20604
- [x] I've read the guidelines for contributing and seen the walkthrough
- [x] I've posted a comment on an issue with a detailed description of how I am planning to contribute and got approval from a member of the team
- [x] The code builds and tests pass locally (also verified by our automated build checks)
- [x] Commit messages follow this format:
Summary of the changes
- Detail 1
- Detail 2
Fixes #bugnumber
- [x] Tests for the changes have been added (for bug fixes / features)
- [x] Code follows the same patterns and style as existing code in this repo
@roji @cincuranet This is ready to review again.
@roji GitHub wasn't letting me reply to this comment (https://github.com/dotnet/efcore/pull/33706#discussion_r1623792960), but the behavior we want is for the result to be an empty string if we call ToString on a nullable enum, since that's what C# does (https://learn.microsoft.com/en-us/dotnet/api/system.nullable-1.tostring?view=net-8.0). I tested it, and that change is still necessary, otherwise the code inside that if block bypasses the ToString call and just returns null instead of the empty string.
@roji Of course! Thanks for all your guidance. Is there anything I need to do for this to get it into a release build (I'm assuming it'll be in one of the .NET 9 previews)?
Nope, it's merged and will appear in a coming preview!
Awesome, thanks!