SparseTypes.EntityFrameworkCore 0.1.0-rc1.31

This is a prerelease version of SparseTypes.EntityFrameworkCore.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package SparseTypes.EntityFrameworkCore --version 0.1.0-rc1.31
                    
NuGet\Install-Package SparseTypes.EntityFrameworkCore -Version 0.1.0-rc1.31
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SparseTypes.EntityFrameworkCore" Version="0.1.0-rc1.31" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SparseTypes.EntityFrameworkCore" Version="0.1.0-rc1.31" />
                    
Directory.Packages.props
<PackageReference Include="SparseTypes.EntityFrameworkCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SparseTypes.EntityFrameworkCore --version 0.1.0-rc1.31
                    
#r "nuget: SparseTypes.EntityFrameworkCore, 0.1.0-rc1.31"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SparseTypes.EntityFrameworkCore@0.1.0-rc1.31
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SparseTypes.EntityFrameworkCore&version=0.1.0-rc1.31&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=SparseTypes.EntityFrameworkCore&version=0.1.0-rc1.31&prerelease
                    
Install as a Cake Tool

SparseTypes.EntityFrameworkCore

Direct ChangeSet-to-entity mapping from DTOs onto tracked EF Core entities.

Status: production-usable mapping for issue #228. The accepted ISparseChangeSet is both the strict write mask and the value source: only changed members execute their setters, new values come from the typed transitions, and there is no desired DTO argument. Apply never queries, never calls SaveChanges, and never rebases. Orchestration (read-side mapping, RebaseOnto, authorization, load/query, SaveChanges, transactions) stays application-owned.

How it works:

  • Declare [SparseFragmentMapper<TEntity, TDto>] on a dedicated partial mapper class with an optional parameterless Configure() that uses the generated Map member. The ordinary generator emits conventional defaults (same-name scalars, nested objects, collection markers) into an external companion, implements IEntityModelMapping<TEntity, TDto> on the mapper, and backs Map with the builder active for the current plan build; explicit entries replace each default exactly once. Mappers with a parameterless constructor additionally gain an OrderMapper.Create(db.Model) shorthand. Keyed child collections use Collection with path-scoped Element child overrides (omitted when the conventional child mappings suffice) plus explicit key, factory, removal (Delete/Detach/SoftDelete/Remove), and opt-in Order policies. Map is usable only during the synchronous Configure call; overlapping builds on one (singleton) instance serialize and leave nothing retained.
  • Build with OrderMapper.Create(model) for partial mappers, or SparseEntityMapper<TEntity, TDto>.Create(mapping, model) otherwise. Creation validates the full coverage manifest against the EF IModel, so a dormant unmapped member fails here. Each call builds a fresh plan for that mapping instance; reuse the returned mapper for repeated applies.
  • Call Apply(context, entity, accepted) with the tracked entity and the accepted/rebased change set, then save explicitly. ApplyWithResult additionally correlates created children by path-scoped DTO temporary identity for the authoritative DTO and client Reconcile.

Safety defaults:

  • Identity (primary/alternate keys), generated, concurrency-token, and shadow members are never written unless explicitly allowed with AllowWrite.
  • Missing after-state is not silent null: the default policy throws, and each member can opt into Ignore, SetDefault, or SetNull.
  • Validation precedes any write: a deterministic failure leaves the entity graph and the ChangeTracker untouched.
  • Keyed collections sync by stable delta over loaded navigations only: unloaded navigations, unknown or foreign-parent keys, colliding identities, duplicate path-scoped temporaries, incomplete order evidence, and missing removal policies fail explicitly instead of guessing. A loaded navigation is not proof of completeness: filtered includes are unsupported for removal/reorder transitions.
  • No unassigned sentinel is ever inferred from default(TKey); assigned keys always take precedence over temporary lookup.
  • Changed declared-only collection paths, unkeyed sequences, and skip navigations are rejected with a diagnostic.
  • Unmapped or ambiguous paths fail explicitly instead of disappearing.

See docs/efcore-mapping.md in the repository for the full API, lifecycle, and the supported/unsupported matrix.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-rc1.182 43 11/13/2026
0.1.0-rc1.172 57 11/9/2026
0.1.0-rc1.40 76 10/27/2026
0.1.0-rc1.31 70 10/27/2026