RCommon.Entities 2.3.2-alpha.0.2

This is a prerelease version of RCommon.Entities.
There is a newer version of this package available.
See the version list below for details.
dotnet add package RCommon.Entities --version 2.3.2-alpha.0.2
                    
NuGet\Install-Package RCommon.Entities -Version 2.3.2-alpha.0.2
                    
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="RCommon.Entities" Version="2.3.2-alpha.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RCommon.Entities" Version="2.3.2-alpha.0.2" />
                    
Directory.Packages.props
<PackageReference Include="RCommon.Entities" />
                    
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 RCommon.Entities --version 2.3.2-alpha.0.2
                    
#r "nuget: RCommon.Entities, 2.3.2-alpha.0.2"
                    
#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 RCommon.Entities@2.3.2-alpha.0.2
                    
#: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=RCommon.Entities&version=2.3.2-alpha.0.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=RCommon.Entities&version=2.3.2-alpha.0.2&prerelease
                    
Install as a Cake Tool

RCommon.Entities

Domain entity base classes for the RCommon framework, providing a strongly-typed BusinessEntity<TKey> base with built-in transactional event tracking, auditing support via AuditedEntity, and an IEntityEventTracker that collects and emits entity events through the event routing infrastructure.

Features

  • BusinessEntity and BusinessEntity<TKey> abstract base classes with composite and single-key support
  • Built-in transactional (local) event accumulation on entities via AddLocalEvent, RemoveLocalEvent, and ClearLocalEvents
  • Entity-level event notifications (TransactionalEventAdded, TransactionalEventRemoved, TransactionalEventsCleared) for observing event changes
  • AuditedEntity base classes that track CreatedBy, DateCreated, LastModifiedBy, and DateLastModified with flexible user types
  • ITrackedEntity interface for opting entities into event tracking
  • IEntityEventTracker and InMemoryEntityEventTracker for collecting entity events across object graphs and routing them through IEventRouter
  • EntityNotFoundException for consistent "entity not found" error handling with type and ID context

Installation

dotnet add package RCommon.Entities

Usage

using RCommon.Entities;
using RCommon.Models.Events;

// Define a domain entity with a GUID key
public class Order : BusinessEntity<Guid>
{
    public string ProductName { get; set; }
    public int Quantity { get; set; }

    public void Submit()
    {
        // Add a transactional event that will be emitted on persistence
        AddLocalEvent(new OrderSubmittedEvent { OrderId = Id });
    }
}

// Define an audited entity tracking who created/modified it
public class Invoice : AuditedEntity<Guid, string, string>
{
    public decimal Amount { get; set; }
    public string Currency { get; set; }
}

// Emit entity events through the event router
public class OrderService
{
    private readonly IEntityEventTracker _eventTracker;

    public OrderService(IEntityEventTracker eventTracker)
    {
        _eventTracker = eventTracker;
    }

    public async Task ProcessOrderAsync(Order order)
    {
        order.Submit();
        _eventTracker.AddEntity(order);
        await _eventTracker.EmitTransactionalEventsAsync();
    }
}

Key Types

Type Description
IBusinessEntity Base entity interface with composite key support and local event collection
IBusinessEntity<TKey> Entity interface with a single strongly-typed Id property
BusinessEntity Abstract base class with transactional event tracking and entity equality
BusinessEntity<TKey> Generic base class adding a typed primary key to BusinessEntity
IAuditedEntity<TCreatedByUser, TLastModifiedByUser> Audit contract with created/modified user and timestamp properties
AuditedEntity<TKey, TCreatedByUser, TLastModifiedByUser> Base class combining BusinessEntity<TKey> with full audit tracking
ITrackedEntity Marks an entity as eligible for event tracking via AllowEventTracking
IEntityEventTracker Collects tracked entities and emits their transactional events
InMemoryEntityEventTracker In-memory implementation that traverses entity object graphs and routes events
EntityNotFoundException Exception for when an expected entity does not exist, with type and ID context

Documentation

For full documentation, visit rcommon.com.

  • RCommon.Core - Foundation package with event bus, builder pattern, guards, and extensions
  • RCommon.Models - Shared models for CQRS commands, queries, events, pagination, and execution results

License

Licensed under the Apache License, Version 2.0.

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

Showing the top 1 NuGet packages that depend on RCommon.Entities:

Package Downloads
RCommon.Persistence

A cohesive set of infrastructure libraries for dotnet that utilizes abstractions for event handling, persistence, unit of work, mediator, distributed messaging, event bus, CQRS, email, and more

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.4.1 78 2/18/2026
2.3.2-alpha.0.3 27 2/18/2026
2.3.2-alpha.0.2 30 2/18/2026
2.3.2-alpha.0.1 56 2/9/2026
2.3.1 227 2/5/2026
2.3.0 216 2/3/2026
2.2.2-alpha.0.1 394 12/11/2025
2.2.1-alpha.0.2 131 10/24/2025
2.2.1-alpha.0.1 147 10/24/2025
2.1.11-alpha.0.2 121 10/24/2025
2.1.11-alpha.0.1 99 7/18/2025
2.1.10 392 7/17/2025
2.1.9-alpha.0.1 150 7/17/2025
2.1.2.4 335 5/21/2025
2.1.2.3 310 5/1/2025
2.1.2.2 614 1/23/2025
2.1.2.1 276 1/17/2025
2.1.2 268 1/17/2025
2.1.1.4 273 1/7/2025
0.0.0-alpha.0 150 7/17/2025
Loading failed