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
<PackageReference Include="Franz.Common.Business" Version="2.1.4" />
<PackageVersion Include="Franz.Common.Business" Version="2.1.4" />
<PackageReference Include="Franz.Common.Business" />
paket add Franz.Common.Business --version 2.1.4
#r "nuget: Franz.Common.Business, 2.1.4"
#:package Franz.Common.Business@2.1.4
#addin nuget:?package=Franz.Common.Business&version=2.1.4
#tool nuget:?package=Franz.Common.Business&version=2.1.4
๐ฆ 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 (
Guidorint) - 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
Guidandintprimary 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 (
SetIdeliminated) - 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 | Versions 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. |
-
net10.0
- Franz.Common.DependencyInjection (>= 2.1.4)
- Franz.Common.Errors (>= 2.1.4)
- Franz.Common.Mediator (>= 2.1.4)
- Microsoft.Extensions.DependencyInjection (>= 10.0.7)
- Scrutor (>= 7.0.0)
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 |