Uploaded image for project: 'Entity Framework'
  1. Entity Framework
  2. EF-182

Numeric key properties should not specify auto generation by default

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Unknown Unknown
    • 8.2.2
    • Affects Version/s: None
    • None
    • None
    • Dotnet Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      By relying on the default Value Generation strategy in EF8 our numeric types were considered ValueGenerated.OnAdd when a key.

      We did not provide an auto generator and so if left un-set you would get an error.

      Due to changes in EF9 (either intentional or not) even setting them now throws an exception error.

      We should prevent specify that number types are auto generated by default any longer to avoid this issue.

      Technically this is a breaking change IF somebody had previously overrode our MongoValueGeneratorSelector directly to return a generator rather than registering it directly with the model builder but the EF team assures me this is very uncommon/irregular so we'll treat this as a regular patch release.

            Assignee:
            damien.guard@mongodb.com Damien Guard
            Reporter:
            damien.guard@mongodb.com Damien Guard
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: