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
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 customIValueGeneratorSelectororIValueGeneratorCacheservices.What's Needed
IValueGeneratorSelector
Select appropriate value generators based on property configuration:
Guidprimary keysValue Generation Strategies
ValueGeneratedOnAdd— generate value on insert (identity columns, GUIDs)ValueGeneratedOnAddOrUpdate— generate on insert or update (computed columns, timestamps)HiLoorSequencepatterns (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