efcore icon indicating copy to clipboard operation
efcore copied to clipboard

Translate ToString() over enums

Open Danevandy99 opened this issue 1 year ago • 1 comments

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

Danevandy99 avatar May 13 '24 11:05 Danevandy99

@roji @cincuranet This is ready to review again.

Danevandy99 avatar May 16 '24 00:05 Danevandy99

@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.

Danevandy99 avatar Jun 04 '24 02:06 Danevandy99

@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)?

Danevandy99 avatar Jun 04 '24 18:06 Danevandy99

Nope, it's merged and will appear in a coming preview!

roji avatar Jun 04 '24 19:06 roji

Awesome, thanks!

Danevandy99 avatar Jun 05 '24 11:06 Danevandy99