Franz.Common.Business 1.6.15

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

Franz.Common.Business

A core library of the Franz Framework, designed to facilitate Domain-Driven Design (DDD), Event Sourcing, and CQRS (Command Query Responsibility Segregation) in .NET applications. It provides abstractions, utilities, and patterns for building scalable, auditable, and testable business logic.


  • Current Version: 1.6.15

Features

1. Domain-Driven Design (DDD) Building Blocks

Entities

Base class for domain objects with identity, auditing, and lifecycle management baked in:

  • Strongly typed Id.
  • PersistentId (GUID) for cross-system correlation.
  • Built-in audit fields (DateCreated, LastModifiedDate, CreatedBy, etc.).
  • Soft delete support (IsDeleted, DateDeleted, DeletedBy).
  • Correct equality semantics (==, !=, Equals, GetHashCode).
public abstract class Entity<TId> : IEntity
{
    public TId Id { get; protected set; } = default!;
    public Guid PersistentId { get; private set; } = Guid.NewGuid();

    // Audit
    public DateTime DateCreated { get; private set; }
    public DateTime LastModifiedDate { get; private set; }
    public string CreatedBy { get; private set; } = string.Empty;
    public string? LastModifiedBy { get; private set; }

    // Lifecycle
    public bool IsDeleted { get; private set; }
    public DateTime? DateDeleted { get; private set; }
    public string? DeletedBy { get; private set; }

    public void MarkCreated(string createdBy) { ... }
    public void MarkUpdated(string modifiedBy) { ... }
    public void MarkDeleted(string deletedBy) { ... }

    public bool IsTransient() => EqualityComparer<TId>.Default.Equals(Id, default!);

    public override bool Equals(object? obj) { ... }
    public override int GetHashCode() { ... }

    public static bool operator ==(Entity<TId>? left, Entity<TId>? right) => ...
    public static bool operator !=(Entity<TId>? left, Entity<TId>? right) => ...
}

➡️ A non-generic version Entity : Entity<int> is also provided for convenience.


Value Objects

Immutable, equality-driven domain concepts.

public class Address : ValueObject
{
    public string Street { get; }
    public string City { get; }
    public string PostalCode { get; }

    protected override IEnumerable<object> GetEqualityComponents()
    {
        yield return Street;
        yield return City;
        yield return PostalCode;
    }
}
Enumerations

Strongly typed enums with additional behavior and metadata.

Repositories

Interfaces for persistence with strict event-first semantics (see section below).


2. Domain Events

All domain events implement the standardized IDomainEvent interface:

public interface IDomainEvent : IEvent
{
    Guid EventId { get; }
    DateTimeOffset OccurredOn { get; }
    string? CorrelationId { get; }
    Guid? AggregateId { get; }
    string AggregateType { get; }
    string EventType { get; }
}
  • Every event is auditable, traceable, and publish-ready.
  • Provides correlation + observability metadata across distributed systems.

3. Aggregates (Event-Sourced)

  • State modified only via events raised with RaiseEvent().
  • Built-in rehydration & replay for event sourcing.
  • Versioning (Version) tracked automatically.
  • Uncommitted events kept until persistence.
public abstract class AggregateRoot<TEvent> : Entity<Guid>, IAggregateRoot<TEvent>
    where TEvent : IEvent
{
    protected void RaiseEvent(TEvent @event) => ApplyChange(@event, true);
    public void ReplayEvents(IEnumerable<TEvent> events) { ... }
    public void Rehydrate(Guid id, IEnumerable<TEvent> events) { ... }
    public IReadOnlyCollection<TEvent> GetUncommittedChanges() { ... }
}

4. Repository Contract

Persistence is event-first with IAggregateRootRepository:

public interface IAggregateRootRepository<TAggregateRoot, TEvent>
    where TAggregateRoot : class, IAggregateRoot<TEvent>
    where TEvent : IEvent
{
    Task<TAggregateRoot?> GetByIdAsync(Guid id, CancellationToken cancellationToken = default);
    Task SaveAsync(TAggregateRoot aggregate, CancellationToken cancellationToken = default);
}
  • Aggregates are rehydrated from events.
  • Saves commit uncommitted domain events.

5. CQRS Support

  • Commands (ICommandRequest<T>, ICommandHandler<TCommand,TResponse>)
  • Queries (IQueryRequest<T>, IQueryHandler<TQuery,TResponse>)
  • Built-in Mediator pipelines for resilience + logging.

6. Resilience Pipelines

  • Retry
  • CircuitBreaker
  • Timeout
  • Bulkhead (Configurable via appsettings.json).

What’s New in 1.6.2

  • Added auditing + soft delete in Entity<TId>.
  • Introduced IDomainEvent with correlation & audit metadata.
  • Refactored AggregateRoot<TEvent> with strict event sourcing lifecycle.
  • Added IAggregateRootRepository enforcing event-first persistence.
  • Stronger Mediator semantics (SendAsync vs PublishAsync).

1.6.15

  • Fixed a compile-time error in ReadRepository and IReadRepository caused by an incorrect cast from List<T> to IQueryable<T>.

  • Updated GetAll() to return an IReadOnlyCollection<T> for safer read-only semantics instead of forcing a materialized IQueryable<T>.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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 (7)

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

Package Downloads
Franz.Common.Messaging

Shared utility library for the Franz Framework.

Franz.Common.EntityFramework

Shared utility library for the Franz Framework.

Franz.Common.Serialization

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
1.6.15 149 10/20/2025
1.6.14 438 10/15/2025
1.6.3 487 10/9/2025
1.6.2 505 10/7/2025
1.5.9 518 9/24/2025
1.5.4 495 9/23/2025
1.5.3 510 9/21/2025
1.5.2 521 9/21/2025
1.5.0 509 9/21/2025
1.4.4 477 9/20/2025
1.3.14 574 9/18/2025
1.3.13 561 9/18/2025
1.3.5 546 9/17/2025
1.3.4 539 9/16/2025
1.3.3 536 9/16/2025
1.3.2 510 9/15/2025
1.3.1 307 9/12/2025
1.3.0 491 8/25/2025
1.2.65 441 3/3/2025
1.2.64 366 1/29/2025
1.2.63 479 1/27/2025
1.2.62 471 1/8/2025