Skip to content

EF Core: Add value generation support (auto-increment, sequences, GUIDs) #132

@DaveRMaltby

Description

@DaveRMaltby

Summary

The EF Core providers lack proper value generation infrastructure. While the ADO.NET layer supports identity columns via LAST_INSERT_ID(), the EF Core layer doesn't register custom IValueGeneratorSelector or IValueGeneratorCache services.

What's Needed

IValueGeneratorSelector

Select appropriate value generators based on property configuration:

  • Auto-increment integers (already partially supported via LAST_INSERT_ID)
  • GUID generation for Guid primary keys
  • Temporary value generation for tracking entities before save

Value Generation Strategies

  • ValueGeneratedOnAdd — generate value on insert (identity columns, GUIDs)
  • ValueGeneratedOnAddOrUpdate — generate on insert or update (computed columns, timestamps)
  • Proper HiLo or Sequence patterns (may not apply to file-based, but should be explicitly unsupported)

Impact

Without proper value generation, context.SaveChanges() may fail to correctly handle auto-generated primary keys, or may not set them back on the entity after insert.

Standard Reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    deferredDeferred — not addressing now

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions