Provides
IDatabaseMapper<T>/IDatabaseMapper<TSource, TDestination>mapper interfaces, theDatabaseMapper<T>abstract base, and theDatabaseMapperstatic utility for reading and writing convention-based columns (RowVersion,TenantId,IsDeleted, change-log).
CoreEx.Database.Mapping defines the explicit mapping contracts between CoreEx entity types and ADO.NET DatabaseRecord / DatabaseParameterCollection. Rather than using reflection or convention scanning, each entity type has a dedicated mapper class that overrides OnMapFromDb and OnMapToDb, calling record.GetValue<T>("ColumnName") and parameters.AddParameter("ColumnName", value) for each property.
The DatabaseMapper static utility provides MapStandardFromDb and MapStandardToDb extension methods that handle the cross-cutting columns — RowVersion → IETag, TenantId, IsDeleted, and the four change-log columns — so individual mapper implementations only write their entity-specific columns. These are called once per mapper as part of the FromDb/ToDb chain.
| Type | Description |
|---|---|
IDatabaseMapper<T> |
Bidirectional mapper: MapFromDb(DatabaseRecord, OperationType) → T and MapToDb(T, DatabaseParameterCollection, OperationType). |
IDatabaseMapper<TSource, TDestination> |
Two-type variant: maps TSource → TDestination (e.g. entity → database model) and TDestination → TSource. |
DatabaseMapper<T> |
Abstract base for IDatabaseMapper<T>; implements both direction methods by delegating to OnMapFromDb and OnMapToDb virtuals; calls MapStandardFromDb / MapStandardToDb for convention columns. |
DatabaseMapper |
Static utility: MapStandardFromDb(item, record, operationType) reads RowVersion/TenantId/IsDeleted/change-log columns; MapStandardToDb(item, parameters, operationType) writes them. |
CoreEx.Database-DatabaseRecordandDatabaseParameterCollectionare the ADO.NET wrappers consumed by mappers.CoreEx.Mapping-Mapper.MapStandardFromis the in-memory equivalent ofDatabaseMapper.MapStandardFromDbfor entity-to-entity mapping.CoreEx.Entities-IETag,ITenantId,ILogicallyDeleted,IChangeLog, andIChangeLogExare the entity contracts whose properties are mapped byMapStandardFromDb/MapStandardToDb.