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

Configuring a custom type mapper for a generated column breaks value generation #11010

Closed
LeroyK opened this issue Feb 19, 2018 · 1 comment
Closed
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@LeroyK
Copy link

LeroyK commented Feb 19, 2018

Version: 2.1.0-preview2-30132

When using a type mapper as described in #242 on a generated column, EF Core seems to use the model type instead of the provider type to check if its value can be generated.

To reproduce, create an entity with a rowversion property and configure a custom type mapper on that property. EF Core will not handle it as a rowversion column after this.

The fix might be changing .ClrType to .GetProviderClrType() in ValueGeneratorConvention.cs, but I have not tested this and I don't know what other implications this might have.

@ajcvickers
Copy link
Member

@LeroyK I'm working on fixing the issues with value generators and converters, but I am now unsure if this is what you are really hitting, since rowversion doesn't use a value generator. Can you provide some more details on what conversion you are using?

ajcvickers added a commit that referenced this issue Mar 29, 2018
Fixes #11010

Approach is:
* Throw by default if a converter is associated with a property that will use value generation
* However, a value generator to use can be specified:
  * On the property
  * On the type mapping
  * On a converter
* A client-side generator is added to the Guid converters so that Guid key scenarios still work
@ajcvickers ajcvickers added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Mar 30, 2018
@ajcvickers ajcvickers modified the milestones: 2.1.0-preview2, 2.1.0 Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

2 participants