![]() |
VOOZH | about |
dotnet add package RCommon.Entities --version 2.4.1
NuGet\Install-Package RCommon.Entities -Version 2.4.1
<PackageReference Include="RCommon.Entities" Version="2.4.1" />
<PackageVersion Include="RCommon.Entities" Version="2.4.1" />Directory.Packages.props
<PackageReference Include="RCommon.Entities" />Project file
paket add RCommon.Entities --version 2.4.1
#r "nuget: RCommon.Entities, 2.4.1"
#:package RCommon.Entities@2.4.1
#addin nuget:?package=RCommon.Entities&version=2.4.1Install as a Cake Addin
#tool nuget:?package=RCommon.Entities&version=2.4.1Install as a Cake Tool
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.
BusinessEntity and BusinessEntity<TKey> abstract base classes with composite and single-key supportAddLocalEvent, RemoveLocalEvent, and ClearLocalEventsTransactionalEventAdded, TransactionalEventRemoved, TransactionalEventsCleared) for observing event changesAuditedEntity base classes that track CreatedBy, DateCreated, LastModifiedBy, and DateLastModified with flexible user typesITrackedEntity interface for opting entities into event trackingIEntityEventTracker and InMemoryEntityEventTracker for collecting entity events across object graphs and routing them through IEventRouterISoftDelete opt-in interface for logical deletion (IsDeleted flag) instead of physical removalIMultiTenant opt-in interface for tenant-scoped entities (TenantId property)EntityNotFoundException for consistent "entity not found" error handling with type and ID contextdotnet add package RCommon.Entities
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();
}
}
Implement ISoftDelete to opt an entity into logical deletion. Repositories will set IsDeleted = true and perform an UPDATE instead of a physical DELETE:
using RCommon.Entities;
public class Customer : BusinessEntity<int>, ISoftDelete
{
public string Name { get; set; }
public bool IsDeleted { get; set; }
}
// Soft delete — sets IsDeleted = true, performs UPDATE
await repository.DeleteAsync(customer, isSoftDelete: true);
// Physical delete — removes the record entirely
await repository.DeleteAsync(customer, isSoftDelete: false);
Entities implementing ISoftDelete are automatically filtered on read operations -- soft-deleted records are excluded from query results by default.
Implement IMultiTenant to scope an entity to a specific tenant. Repositories will automatically stamp the TenantId on add operations and filter reads to only return records for the current tenant:
using RCommon.Entities;
public class Product : BusinessEntity<int>, IMultiTenant
{
public string Name { get; set; }
public string? TenantId { get; set; }
}
When both interfaces are combined, the entity supports soft delete and tenant isolation:
public class Invoice : BusinessEntity<Guid>, ISoftDelete, IMultiTenant
{
public decimal Amount { get; set; }
public bool IsDeleted { get; set; }
public string? TenantId { get; set; }
}
| 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 |
ISoftDelete |
Opt-in interface for soft delete; adds IsDeleted property for logical deletion |
IMultiTenant |
Opt-in interface for multitenancy; adds TenantId property for tenant scoping |
EntityNotFoundException |
Exception for when an expected entity does not exist, with type and ID context |
For full documentation, visit rcommon.com.
Licensed under the Apache License, Version 2.0.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
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 |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.1.0-alpha.3 | 110 | 5/18/2026 |
| 2.4.2-alpha.0.10 | 95 | 4/5/2026 |
| 2.4.2-alpha.0.9 | 79 | 3/26/2026 |
| 2.4.2-alpha.0.8 | 69 | 3/26/2026 |
| 2.4.2-alpha.0.7 | 69 | 3/26/2026 |
| 2.4.2-alpha.0.6 | 76 | 3/25/2026 |
| 2.4.2-alpha.0.5 | 77 | 3/24/2026 |
| 2.4.2-alpha.0.1 | 74 | 3/24/2026 |
| 2.4.1 | 287 | 2/18/2026 |
| 2.3.2-alpha.0.3 | 81 | 2/18/2026 |
| 2.3.2-alpha.0.2 | 73 | 2/18/2026 |
| 2.3.2-alpha.0.1 | 89 | 2/9/2026 |
| 2.3.1 | 331 | 2/5/2026 |
| 2.3.0 | 243 | 2/3/2026 |
| 2.2.2-alpha.0.1 | 420 | 12/11/2025 |
| 2.2.1-alpha.0.2 | 156 | 10/24/2025 |
| 2.2.1-alpha.0.1 | 170 | 10/24/2025 |
| 2.1.11-alpha.0.2 | 155 | 10/24/2025 |
| 2.1.11-alpha.0.1 | 120 | 7/18/2025 |
| 2.1.10 | 425 | 7/17/2025 |