Skip to content

EntityAxis v0.2.0

Pre-release
Pre-release

Choose a tag to compare

@cbcrouse cbcrouse released this 04 May 05:53
· 4 commits to main since this release

✨ Features

  • Introduced IKeyMapper<TAppKey, TDbKey> abstraction for mapping between application-layer and database-layer entity keys
  • Added built-in key mapper implementations:
    • IdentityKeyMapper<T> for cases where key types match
    • StringToGuidKeyMapper for mapping string IDs to Guid database keys
    • StringToIntKeyMapper for mapping string IDs to int database keys
  • Updated all internal EntityAxis logic to support separate TKey and TDbKey generic parameters across services and handlers
  • Extended the Entity Framework integration to handle TDbKey resolution consistently using the registered key mapper

🛠 Fixes

  • Improved update handling to use mapped database keys via IKeyMapper before invoking FindAsync
  • Internal exception messages now display the original (application-layer) key value when entities are not found, improving traceability

⚠️ Breaking Changes

  • Services like EntityFrameworkQueryService and EntityFrameworkCommandService now support an additional TDbKey parameter
  • Consumers implementing custom EF-based repositories or overrides must account for the TDbKey type and inject a suitable IKeyMapper implementation

🛠 Migration Notes

  • 🔧 All applications must now explicitly register an IKeyMapper<TAppKey, TDbKey> for each entity type used

    • This is required even if TAppKey and TDbKey are the same (e.g., both are Guid)
  • If your application and database key types match, use:

    services.AddSingleton<IKeyMapper<Guid, Guid>, IdentityKeyMapper<Guid>>();
  • If your application uses a string ID mapped to a database Guid, use:

    services.AddSingleton<IKeyMapper<string, Guid>, StringToGuidKeyMapper>();
  • 📦 Make sure to reference the EntityAxis.KeyMappers package to access built-in key mapper implementations