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

Support mapping identity columns to enum properties #25536

Merged
merged 1 commit into from
Aug 17, 2021

Conversation

ajcvickers
Copy link
Member

Fixes #11970

Also, add back in the provider-agnostic check for converters with value generators, but make it less restrictive.

@ajcvickers ajcvickers requested a review from a team August 16, 2021 12:43
src/EFCore/Properties/CoreStrings.Designer.cs Show resolved Hide resolved
if (converter != null)
{
var type = converter.ProviderClrType.UnwrapNullableType();
if (!type.IsInteger()
Copy link
Member

Choose a reason for hiding this comment

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

This seems like a fairly provider-specific thing to embed in the general relational code (e.g. PG doesn't support decimal "identity" columns)...

I don't have a lot of context so I'm not sure what this is supposed to address... but are we OK with other value-generated properties with converters (e.g. GUID, or string or whatever)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds like you have feedback on #25178

Copy link
Member

@roji roji Aug 16, 2021

Choose a reason for hiding this comment

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

Well, AFAIK I'm OK with value conversion for identity/sequence columns, and I guess I'm also OK with value conversion combined with client-side value generation (though maybe I'm missing issues). The check that #25178 removed was against all combinations of conversion and generation, where the check being added here seems to bring back restrictions which seem specific to the SQL Server concept of identity, no?

Copy link
Member Author

Choose a reason for hiding this comment

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

Asking for @AndriySvyryd's opinion on this, since he shared concerns that we were being too lenient by removing the entire check.

Copy link
Member

Choose a reason for hiding this comment

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

I don't know of any specific issues, I'm just concerned with the lack of testing for other types

Copy link
Member Author

Choose a reason for hiding this comment

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

@AndriySvyryd Are you in favor of adding this check back in in, as in this PR?

Copy link
Member

Choose a reason for hiding this comment

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

Yes

Fixes #11970

Also, add back in the provider-agnostic check for converters with value generators, but make it less restrictive.
@ajcvickers ajcvickers force-pushed the ItsAnEnumJimButNotAsYouKnowIt0816 branch from 803545c to 30957d1 Compare August 17, 2021 08:44
@ajcvickers ajcvickers merged commit ab0feee into main Aug 17, 2021
@ajcvickers ajcvickers deleted the ItsAnEnumJimButNotAsYouKnowIt0816 branch August 17, 2021 09:41
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.

Mapping identity columns to enum properties no longer works in 2.1
3 participants