Skip to content
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

Fixes #20604 - Treat ToString as casting to string in the database #33701

Conversation

Danevandy99
Copy link

@Danevandy99 Danevandy99 commented May 11, 2024

Fixes #20604

  • I've read the guidelines for contributing and seen the walkthrough
  • 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
  • The code builds and tests pass locally (also verified by our automated build checks)
  • Commit messages follow this format:
        Summary of the changes
        - Detail 1
        - Detail 2

        Fixes #bugnumber
  • Tests for the changes have been added (for bug fixes / features)
  • Code follows the same patterns and style as existing code in this repo

@Danevandy99
Copy link
Author

Danevandy99 commented May 11, 2024

The build Helix task seems to be stuck, but I'm not sure how to fix that.

@Danevandy99 Danevandy99 force-pushed the enhancement-treat-tostring-as-casting-to-string-in-the-database-take-2 branch from a9f86ad to 4170742 Compare May 12, 2024 00:43
@Danevandy99 Danevandy99 changed the title Fixes #20604 Fixes #20604 - Treat ToString as casting to string in the database May 12, 2024
Copy link
Contributor

@cincuranet cincuranet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but maybe @roji sees something that I don't.

Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look OK, but I'm still a bit unsure as to the general utility of allowing ToString() for enums, which get mapped to integers by default in the database... In other words, this probably is useful only when value-converting the enum to string (which may be OK).

If we really want to allow arbitrary ToString() on anything - regardless of value conversion - we may as well just always ToString(), regardless of the CLR type or anything else (i.e. why limit just to enums?). Otherwise we may want to think a bit more generally before doing this.

Maybe let's discuss this in design today?

@Danevandy99
Copy link
Author

@roji #33706 adds functionality that makes ToString on enums more useful when the enum is mapped to an int in the database.

@roji
Copy link
Member

roji commented May 13, 2024

Yeah, I see - it's just that we probably need to discuss a broader strategy here when it comes to ToString, value conversion, etc. beyond just the enum case.

@Danevandy99
Copy link
Author

Merging changes with #33706

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants