Skip to content

Missing disclaimer about incompatibility of generated values with ValueConversion #2252

Closed

Description

@jahav

For past few hours, I have been trying to use strongly typed ids (e.g. struct CustomerId with int inside instead of a simple int) in a model and so far it looks to be impossible (for Sql Server at least).

HiLo, Identity, just ignore it and use .ValueGeneratedOnAdd.. I always hit brick wall of runtime exception.

Examples:
'Identity value generation cannot be used for the property 'Id' on entity type 'Blog' because the property type is 'Id'. Identity value generation can only be used with signed integer properties.'

System.NotSupportedException: 'Value generation is not supported for property 'Blog.Id' because it has a 'ValueConverter<Id, int>' converter configured. Configure the property to not use value generation using 'ValueGenerated.Never' or 'DatabaseGeneratedOption.None' and specify explicit values instead.'

This should be documented on the page.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Activity

  1. self-assigned this
    on Apr 6, 2020
  2. added this to the 5.0.0 milestone on Apr 6, 2020
  3. modified the milestones: 5.0.0, 6.0.0 on Dec 16, 2020
  4. modified the milestones: 6.0.0, 5.0.0 on Jan 12, 2021
  5. added 3 commits that reference this issue on Jan 17, 2021
    ecf418b
    2ac0208
    fe0d92f
  6. added a commit that references this issue on Jan 19, 2021
    1a9ef8a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions