Franz.Common.Business 2.1.4

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

๐Ÿ“ฆ Franz.Common.Business

A core infrastructure library of the Franz Framework, designed to support Domain-Driven Design (DDD), CQRS, and Event-Sourcing-ready architectures in modern .NET applications.

It provides a clean, deterministic, and production-grade foundation for building scalable business systems with strong separation of concerns.


๐Ÿš€ Version

v2.1.4


๐Ÿง  Core Philosophy

Franz.Common.Business enforces the following principles:

  • Identity is factory-controlled
  • Domain logic is persistence-agnostic
  • Repositories are storage-only abstractions
  • Entities are immutable in identity after creation
  • DI is deterministic and explicit
  • No hidden service locator or runtime DI construction

โœจ Key Features


1. Domain Model (DDD Core)

โœ” Entity Model

All domain entities derive from a unified base:

public abstract class Entity<TId> : IEntity
{
    public TId Id { get; private set; } = default!;

    protected Entity() { }

    protected Entity(TId id)
    {
        Id = id;
    }

    public object GetId() => Id!;
}

โœ” Key characteristics:

  • Strongly typed identity (Guid or int)
  • Factory-controlled identity assignment
  • Immutable identity after creation
  • Equality based on identity
  • EF Core compatible design

2. Identity System

โœ” Supported ID strategies

  • Guid V7 (default standard)
  • int (database-generated identities)

โœ” Centralized ID generation

public interface IIdGenerator<TId>
{
    TId Create();
}

โœ” Default implementation:

public sealed class GuidV7Generator : IIdGenerator<Guid>
{
    public Guid Create() => Guid.CreateVersion7();
}

3. Entity Factories

Entities must be created through controlled factories.

public interface IEntityFactory<TId, TEntity>
    where TEntity : Entity<TId>
{
    TEntity Create();
}

โœ” Responsibilities:

  • Generate entity identity via IIdGenerator<TId>
  • Ensure consistent creation rules
  • Enforce domain construction invariants
  • Prevent identity bypass (e.g. new Entity() misuse)

4. Repositories (Persistence Layer)

Repositories are identity-agnostic and persistence-only abstractions.

public interface IEntityRepository<TEntity>
    where TEntity : class, IEntity
{
    Task<TEntity> GetByIdAsync(object id, CancellationToken cancellationToken = default);
    Task AddAsync(TEntity entity, CancellationToken cancellationToken = default);
    Task UpdateAsync(TEntity entity, CancellationToken cancellationToken = default);
    Task DeleteAsync(TEntity entity, CancellationToken cancellationToken = default);
}

โœ” Design principles:

  • No dependency on TId
  • No domain logic
  • EF Core handles identity resolution
  • Supports both Guid and int primary keys

5. Aggregates & Event Sourcing

โœ” Aggregate Root

Supports event-driven state mutation:

public abstract class AggregateRoot<TEvent> : Entity<Guid>
    where TEvent : IEvent
{
    protected void RaiseEvent(TEvent @event) { }
    public void ReplayEvents(IEnumerable<TEvent> events) { }
    public void Rehydrate(Guid id, IEnumerable<TEvent> events) { }
}

โœ” Features:

  • Event-based state changes
  • Automatic version tracking
  • Uncommitted event collection
  • Full rehydration support

6. Domain Events

All events implement:

public interface IDomainEvent : IEvent
{
    Guid EventId { get; }
    DateTimeOffset OccurredOn { get; }
    string? CorrelationId { get; }
    Guid? AggregateId { get; }
    string AggregateType { get; }
    string EventType { get; }
}

โœ” Benefits:

  • Full auditability
  • Distributed tracing support
  • Event correlation across services

7. CQRS Support

Built-in support for:

  • Commands (ICommandHandler)
  • Queries (IQueryHandler)
  • Mediator-based execution pipeline

8. Resilience Pipelines

Production-ready pipeline support:

  • Retry
  • Circuit Breaker
  • Timeout
  • Bulkhead Isolation

9. Dependency Injection Bootstrap

โœ” Single entry point:

services.AddBusiness(applicationAssembly);
services.AddBusinessPlatform();

โœ” What it registers:

Domain layer
  • IIdGenerator<Guid>
  • IEntityFactory<,>
Mediator layer
  • Command/query pipeline
  • Event dispatching
Handler discovery
  • Automatic handler registration

โš ๏ธ Important Design Rules

โŒ Do NOT:

  • Generate IDs manually (Guid.NewGuid())
  • Bypass factories for entity creation
  • Use service locator inside startup/configuration
  • Introduce custom repository identity types

โœ” Always:

  • Use factories for entity creation
  • Use IIdGenerator<TId> for identity
  • Treat repositories as persistence-only abstractions

๐Ÿงฉ Architecture Overview

Domain Layer
    โ”œโ”€โ”€ Entities (Entity<TId>)
    โ”œโ”€โ”€ Aggregates
    โ”œโ”€โ”€ Value Objects
    โ””โ”€โ”€ Domain Events

Factory Layer
    โ””โ”€โ”€ IEntityFactory<TId, TEntity>

Identity Layer
    โ””โ”€โ”€ IIdGenerator<TId>

Persistence Layer
    โ””โ”€โ”€ IEntityRepository<TEntity>

Application Layer
    โ””โ”€โ”€ CQRS + Mediator

Bootstrap Layer
    โ””โ”€โ”€ AddBusiness()

๐Ÿงช Version History

v2.0.3 โ€“ Architecture Stabilization

  • Enforced factory-driven identity model
  • Removed mutable identity assignment (SetId eliminated)
  • Introduced immutable entity identity lifecycle
  • Simplified repository abstraction (identity-agnostic)
  • Consolidated DI bootstrap into single deterministic entry point
  • Removed ServiceProvider creation from configuration pipeline
  • Improved EF Core compatibility and consistency
  • Strengthened DDD alignment across domain layer

๐Ÿ“Œ Summary

Franz.Common.Business v2.0.3 provides a:

โœ” deterministic โœ” factory-driven โœ” EF Core compatible โœ” DDD-aligned โœ” CQRS-ready

foundation for enterprise-grade .NET applications.


๐Ÿง  Final Note

This library enforces architectural discipline by design, not convention.

It ensures that:

  • identity is always controlled
  • domain logic remains pure
  • persistence remains isolated
  • system composition is deterministic

---

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

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

Package Downloads
Franz.Common.Serialization

Shared utility library for the Franz Framework.

Franz.Common.Messaging

Shared utility library for the Franz Framework.

Franz.Common.EntityFramework

Shared utility library for the Franz Framework.

Franz.Common.Bootstrap

Shared utility library for the Franz Framework.

Franz.Common.MongoDB

Shared utility library for the Franz Framework.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.4 355 4/27/2026
2.1.3 333 4/26/2026
2.1.2 339 4/26/2026
2.1.1 347 4/22/2026
2.0.2 358 3/30/2026
2.0.1 338 3/29/2026
1.7.8 357 3/2/2026
1.7.7 384 1/31/2026
1.7.6 388 1/22/2026
1.7.5 354 1/10/2026
1.7.4 371 12/27/2025
1.7.3 458 12/22/2025
1.7.2 444 12/21/2025
1.7.1 399 12/20/2025
1.7.0 522 12/16/2025
1.6.21 418 11/27/2025
1.6.20 437 11/24/2025
1.6.19 510 10/25/2025
1.6.15 550 10/20/2025
1.6.14 542 10/15/2025
Loading failed