Franz.Common.EntityFramework 2.2.1

dotnet add package Franz.Common.EntityFramework --version 2.2.1
                    
NuGet\Install-Package Franz.Common.EntityFramework -Version 2.2.1
                    
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="Franz.Common.EntityFramework" Version="2.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Franz.Common.EntityFramework" Version="2.2.1" />
                    
Directory.Packages.props
<PackageReference Include="Franz.Common.EntityFramework" />
                    
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 Franz.Common.EntityFramework --version 2.2.1
                    
#r "nuget: Franz.Common.EntityFramework, 2.2.1"
                    
#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 Franz.Common.EntityFramework@2.2.1
                    
#: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=Franz.Common.EntityFramework&version=2.2.1
                    
Install as a Cake Addin
#tool nuget:?package=Franz.Common.EntityFramework&version=2.2.1
                    
Install as a Cake Tool

πŸ“¦ Franz.Common.EntityFramework v2.2.1

πŸš€ Version

v2.2.1


🧠 Architectural Evolution (IMPORTANT CHANGE)

❌ Before (v2.1.4)

β€œPragmatic EF Core persistence library”

βœ… Now (v2.2.1)

Framework-managed transactional persistence engine with opt-in orchestration


🧠 Core Philosophy (NEW)

Persistence is no longer a repository responsibility β€” it is a framework-controlled consistency boundary.

Key shift:

  • Repositories = mutation intent
  • UnitOfWork = commit boundary
  • Pipeline = implicit transaction scope
  • DbContext = execution engine

βš–οΈ Transaction Model (NEW CORE CONCEPT)

Franz now supports 3 execution modes:


🟒 1. Auto-Commit Mode (Simple Operations)

Repositories may persist immediately for isolated operations:

  • CRUD endpoints
  • single aggregate updates
  • simple queries

⚠️ Not intended for multi-aggregate consistency


πŸ”΅ 2. Orchestrated Mode (UnitOfWork)

Explicit transactional boundary:

await repo.AddAsync(entity);
await repo.AddRangeAsync(entities);

await unitOfWork.SaveChangesAsync();

Used for:

  • Skill creation
  • Hero creation
  • snapshot generation pipelines
  • multi-aggregate consistency flows

🟣 3. Pipeline Mode (Implicit Transaction)

Command β†’ PipelineBehavior β†’ Transaction Scope β†’ Commit

Used for:

  • CQRS commands
  • application layer operations
  • validated workflows

🧱 Core Architecture Concepts (UPDATED)


1. DbContextBase (Execution Engine)

DbContextBase is now explicitly:

The transactional execution engine of the framework

Responsibilities:

  • Change tracking
  • audit lifecycle
  • soft delete enforcement
  • domain event dispatching
  • transaction coordination
  • unit-of-work execution target

Key behavior change:

BEFORE:

β€œDbContext applies behavior”

NOW:

β€œDbContext executes framework-defined transactional rules”


2. Repository System (REFINED MODEL)


πŸ“¦ EntityRepository (Intent-Based Persistence)

public class EntityRepository<TDbContext, TEntity>

βœ” Responsibilities:

  • Express persistence intent
  • Track entity state
  • Support batch operations
  • NO transaction ownership

❌ Removed responsibility:

  • SaveChanges ownership
  • transactional guarantees

πŸ”₯ NEW ADDITIONS (v2.2.1)

Batch operations added:

  • AddRangeAsync
  • UpdateRangeAsync
  • DeleteRangeAsync
  • SoftDeleteRangeAsync

🧠 New rule:

Repositories describe what changes, not when changes are committed


3. Unit of Work (NEW CORE COMPONENT)

πŸ“¦ IUnitOfWork

public interface IUnitOfWork
{
    Task<int> SaveChangesAsync(CancellationToken cancellationToken = default);
}

βœ” Role:

  • Defines explicit transaction boundary
  • Ensures atomic multi-repository operations
  • Guarantees deterministic state commits

🧠 Key principle:

If multiple aggregates are involved, UnitOfWork is mandatory.


4. Soft Delete System (UNCHANGED BUT REINFORCED)

Still applies globally:

DELETE β†’ IsDeleted = true

βœ” Now enforced at framework level only

  • repositories no longer handle delete semantics
  • DbContext enforces policy

5. Domain Events System (ENHANCED CLARITY)

Lifecycle:

  1. entities modified
  2. DbContext tracks changes
  3. commit executed
  4. events dispatched AFTER transaction completion

🧠 NEW RULE:

Events are emitted only after UnitOfWork commit success OR pipeline completion.


6. Entity Model (UNCHANGED BUT REINFORCED)

Still:

public abstract class Entity<TId>

βœ” Guarantees:

  • identity ownership stays in domain
  • audit is framework-managed
  • soft delete is universal

7. Dependency Injection System (UPDATED SEMANTICS)

Auto-discovery now explicitly scoped:

  • repositories β†’ persistence layer
  • behaviors β†’ pipeline layer
  • unit of work β†’ opt-in transactional layer

NEW ADDITION:

services.AddUnitOfWork<TDbContext>();

Meaning:

β€œEnable explicit transactional orchestration mode”


8. EF Entity Discovery (UNCHANGED)

Still:

  • DbSet scanning
  • IEntity filtering
  • aggregate exclusion

⚠️ DESIGN RULES (UPDATED)

❌ FORBIDDEN

  • repositories calling SaveChanges
  • implicit multi-aggregate persistence
  • mixing transaction boundaries inside domain logic

βœ” REQUIRED

  • UnitOfWork for multi-entity consistency
  • batch operations for performance
  • pipeline for CQRS safety
  • DbContext as only persistence executor

🧭 Updated Architecture Overview

DOMAIN LAYER
 β”œβ”€β”€ Entity<TId>
 β”œβ”€β”€ Aggregates
 β”œβ”€β”€ Domain Events

APPLICATION LAYER
 β”œβ”€β”€ CQRS
 β”œβ”€β”€ SnapshotResolver
 β”œβ”€β”€ Orchestration Services

FRAMEWORK LAYER (Franz 2.2.1)
 β”œβ”€β”€ EntityRepository (intent-only)
 β”œβ”€β”€ AddRange / UpdateRange / DeleteRange
 β”œβ”€β”€ UnitOfWork (transaction boundary)
 β”œβ”€β”€ PersistenceBehavior (pipeline transaction scope)

INFRASTRUCTURE LAYER
 β”œβ”€β”€ DbContextBase (execution engine)
 β”œβ”€β”€ ChangeTracker
 β”œβ”€β”€ Soft Delete filter
 β”œβ”€β”€ Event dispatcher

EF CORE LAYER
 β”œβ”€β”€ DbSet<TEntity>
 β”œβ”€β”€ SQL translation
 β”œβ”€β”€ transaction execution

πŸ§ͺ VERSION HISTORY (UPGRADED)

v2.2.1 β€” Transactional Framework Evolution

🧠 Major Changes

  • Removed β€œrepository owns persistence” model
  • Introduced UnitOfWork as explicit transaction boundary
  • Added batch operations (AddRange / UpdateRange / SoftDeleteRange)
  • Redefined DbContext as execution engine
  • Formalized pipeline-based transactional safety model

βš™οΈ Improvements

  • deterministic multi-aggregate consistency
  • improved snapshot safety
  • reduced hidden side effects
  • clearer orchestration boundaries
  • scalable for simulation-heavy systems

⚠️ Breaking Change Conceptually

  • SaveChanges is no longer repository-owned
  • transaction ownership is now explicit or pipeline-driven

πŸ“Œ FINAL SUMMARY

Franz.Common.EntityFramework v2.2.1 is now:

βœ” not just EF abstraction βœ” not just repository simplification ❌ not CRUD wrapper anymore βœ” a transactional orchestration framework


🧠 Closing Statement (matches your philosophy)

This framework no longer abstracts Entity Framework β€” it formalizes deterministic persistence boundaries over it, ensuring consistency across complex domain simulations and multi-aggregate workflows.


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 (9)

Showing the top 5 NuGet packages that depend on Franz.Common.EntityFramework:

Package Downloads
Franz.Common.EntityFramework.MariaDB

Shared utility library for the Franz Framework.

Franz.Common.EntityFramework.SQLServer

Shared utility library for the Franz Framework.

Franz.Common.EntityFramework.PostGres

Shared utility library for the Franz Framework.

Franz.Common.MongoDB

Shared utility library for the Franz Framework.

Franz.Common.SSO

Shared utility library for the Franz Framework.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.2.1 187 5/24/2026
2.1.4 184 4/27/2026
2.1.3 165 4/26/2026
2.1.2 173 4/26/2026
2.1.1 182 4/22/2026
2.0.2 179 3/30/2026
2.0.1 173 3/29/2026
1.7.8 180 3/2/2026
1.7.7 193 1/31/2026
1.7.6 195 1/22/2026
1.7.5 197 1/10/2026
1.7.4 187 12/27/2025
1.7.3 274 12/22/2025
1.7.2 259 12/21/2025
1.7.1 212 12/20/2025
1.7.0 364 12/16/2025
1.6.21 278 11/27/2025
1.6.20 291 11/24/2025
1.6.19 283 10/25/2025
1.6.15 316 10/20/2025
Loading failed