Vorn.EntityManagement
4.6.0-alpha
See the version list below for details.
dotnet add package Vorn.EntityManagement --version 4.6.0-alpha
NuGet\Install-Package Vorn.EntityManagement -Version 4.6.0-alpha
<PackageReference Include="Vorn.EntityManagement" Version="4.6.0-alpha" />
<PackageVersion Include="Vorn.EntityManagement" Version="4.6.0-alpha" />
<PackageReference Include="Vorn.EntityManagement" />
paket add Vorn.EntityManagement --version 4.6.0-alpha
#r "nuget: Vorn.EntityManagement, 4.6.0-alpha"
#:package Vorn.EntityManagement@4.6.0-alpha
#addin nuget:?package=Vorn.EntityManagement&version=4.6.0-alpha&prerelease
#tool nuget:?package=Vorn.EntityManagement&version=4.6.0-alpha&prerelease
Vorn.EntityManagement
Philosophy
Vorn.EntityManagement
is the foundation of the Vorn data platform. The package embraces CQRS and mediator-driven orchestration to keep entity workflows composable, testable, and cache aware. The library intentionally separates persistence logic from the domain model through command/query records so that your application can evolve without sacrificing correctness. The design centers on three pillars:
- Explicit intent – CRUD operations are expressed as MediatR requests so that every write or query is observable and interceptable by cross-cutting behaviors (logging, validation, or auditing).
- Cache-first experience – The provided cache abstractions (
IEntityCache
,EntityMemoryCache
, and invalidation services) ensure that entity lifetimes are controlled in one location while avoiding stale reads. - Descriptor-driven access – Entities expose typed descriptors (
EntityDescriptor
) that filter reads, updates, and removals. This promotes discoverable API surface instead of ad-hoc query objects.
Package structure
The package exposes a cohesive set of primitives that can be combined in vertical slices. Core components include:
Entity
– Base record for aggregate roots with identity helpers.EntityDescriptor
– Value object representing the filter used in queries and bulk operations.EntityService<TEntity, TDescriptor, TDto, TDescriptorDto>
– High-level service that wraps MediatR and mapping delegates to provide DTO-friendly operations.- Commands and queries – Records such as
AddEntityCommand
,UpdateEntitiesCommand
,RemoveEntitiesByDescriptorCommand
, andGetEntityByIdQuery
express the intent for MediatR handlers in your application. - Infrastructure helpers – Caching (
EntityCacheInvalidationService
,EntityMemoryCache
), repository abstraction (IEntityRepository
), and notification pipeline support (EntityNotification
).
These building blocks allow you to layer domain logic, infrastructure, and presentation independently while reusing the same entity orchestration flows.
Getting started
1. Install the package
Install-Package Vorn.EntityManagement
2. Define your entity
public sealed class Document : Entity
{
public string Title { get; init; } = string.Empty;
public string Body { get; init; } = string.Empty;
}
public sealed class DocumentDescriptor : EntityDescriptor
{
public required string TenantId { get; init; }
public override IReadOnlyDictionary<string, object?> AsDictionary()
=> new Dictionary<string, object?> { ["tenant"] = TenantId };
}
3. Implement handlers
Handlers react to commands and queries using your persistence stack (Entity Framework Core, Dapper, etc.).
internal sealed class AddDocumentHandler(IMediator mediator, IDocumentDbContext db)
: IRequestHandler<AddEntityCommand<Document, DocumentDescriptor>, Document?>
{
public async Task<Document?> Handle(
AddEntityCommand<Document, DocumentDescriptor> request,
CancellationToken cancellationToken)
{
db.Documents.Add(request.Entity);
await db.SaveChangesAsync(cancellationToken);
return request.Entity;
}
}
4. Expose an application service
EntityService
wires together MediatR and DTO mapping so consumers can work with transport-friendly types while keeping domain logic in handlers.
public sealed class DocumentService(IMediator mediator)
: EntityService<Document, DocumentDescriptor, DocumentDto, DocumentDescriptorDto>(
mediator,
dto => new DocumentDto { Id = dto.Id, Title = dto.Title },
dto => new Document { Id = dto.Id, Title = dto.Title },
descriptor => new DocumentDescriptor { TenantId = descriptor.TenantId });
The service now exposes methods such as AddAsync
, UpdateAsync
, RemoveAsync
, and GetAsync
across both entity and DTO representations.
5. Configure caching (optional)
You can plug in the in-memory cache or create your own implementation.
services.AddSingleton<IEntityCache, EntityMemoryCache>();
services.AddSingleton<IEntityCacheInvalidationService, EntityCacheInvalidationService>();
By routing mutations through the provided commands, cache invalidation happens automatically and subscribers can react to EntityNotification
events.
Usage tips
- Use descriptors to capture multi-tenant or contextual filtering concerns. Queries like
CountEntitiesQuery<TEntity, TDescriptor>
already accept descriptors and flow through your handlers. - Combine the package with
Vorn.EntityManagement.Generators
to reduce boilerplate descriptors and handlers. - MediatR pipelines let you add behaviors such as validation, tracing, and audit logging without changing the surface API.
Release artifacts
The README file is bundled with the NuGet package (PackageReadmeFile
) so consumers can review philosophy and usage from NuGet.org, Visual Studio, or dotnet list package --include-transitive
output.
Product | Versions 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 was computed. 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. |
-
net8.0
- MediatR (>= 12.5.0)
- Microsoft.EntityFrameworkCore (>= 8.0.19)
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Vorn.EntityManagement:
Package | Downloads |
---|---|
Vorn.EntityManagement.SignalR.Server
This library provides SignalR entity server base class. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
4.6.0-beta | 17 | 10/5/2025 |
4.6.0-alpha | 20 | 10/5/2025 |
4.5.0 | 42 | 10/4/2025 |
4.4.0 | 230 | 9/24/2025 |
4.3.0 | 234 | 9/23/2025 |
4.0.0 | 245 | 9/22/2025 |
4.0.0-rc3 | 162 | 9/21/2025 |
4.0.0-rc2 | 141 | 9/21/2025 |
4.0.0-rc1 | 149 | 9/21/2025 |
4.0.0-gamma | 164 | 9/20/2025 |
4.0.0-delta | 160 | 9/20/2025 |
4.0.0-beta | 158 | 9/20/2025 |
4.0.0-alpha | 178 | 9/20/2025 |
3.5.0 | 328 | 9/17/2025 |
3.4.0 | 305 | 9/17/2025 |
3.3.0 | 310 | 9/17/2025 |
3.0.0 | 344 | 9/16/2025 |
2.3.0 | 178 | 9/8/2025 |
2.2.1 | 119 | 9/6/2025 |
2.2.0 | 88 | 9/6/2025 |
2.1.1 | 81 | 9/6/2025 |
2.1.0 | 93 | 9/6/2025 |
2.0.0 | 234 | 9/1/2025 |
1.0.0 | 223 | 8/27/2025 |