Resrcify.SharedKernel.DomainDrivenDesign
4.0.0
dotnet add package Resrcify.SharedKernel.DomainDrivenDesign --version 4.0.0
NuGet\Install-Package Resrcify.SharedKernel.DomainDrivenDesign -Version 4.0.0
<PackageReference Include="Resrcify.SharedKernel.DomainDrivenDesign" Version="4.0.0" />
<PackageVersion Include="Resrcify.SharedKernel.DomainDrivenDesign" Version="4.0.0" />
<PackageReference Include="Resrcify.SharedKernel.DomainDrivenDesign" />
paket add Resrcify.SharedKernel.DomainDrivenDesign --version 4.0.0
#r "nuget: Resrcify.SharedKernel.DomainDrivenDesign, 4.0.0"
#:package Resrcify.SharedKernel.DomainDrivenDesign@4.0.0
#addin nuget:?package=Resrcify.SharedKernel.DomainDrivenDesign&version=4.0.0
#tool nuget:?package=Resrcify.SharedKernel.DomainDrivenDesign&version=4.0.0
Resrcify.SharedKernel.DomainDrivenDesign
Resrcify.SharedKernel.DomainDrivenDesign provides reusable DDD primitives and abstractions for entities, value objects, domain events, and aggregate roots.
Table of Contents
What you get
- Interfaces from
Resrcify.SharedKernel.Abstractions.DomainDrivenDesign:IAggregateRoot<TId>IAuditableEntityIDeletableEntityIDomainEventISingleValueObject<TSelf, TValue>(a value object stored as its one value; see below)
- Primitives in
Primitives/:AggregateRoot<TId>Entity<TId>DomainEventEnumeration<TEnum>ValueObject
Prerequisites
- .NET 10 SDK.
Install
Option A: Project reference
<ProjectReference Include="..\path\to\Resrcify.SharedKernel.DomainDrivenDesign.csproj" />
Option B: NuGet package
<PackageReference Include="Resrcify.SharedKernel.DomainDrivenDesign" Version="<latest>" />
CLI:
dotnet add package Resrcify.SharedKernel.DomainDrivenDesign
Core abstractions
- Entity identity and equality via
Entity<TId>. - Aggregate consistency boundary via
AggregateRoot<TId>. - Event capture inside aggregates via
RaiseDomainEvent(...)andGetDomainEvents(). - Immutable value semantics via
ValueObject. - Smart-enum style values via
Enumeration<TEnum>.
Usage guide
Aggregate root example
public sealed class Order
: AggregateRoot<int>
{
private readonly List<OrderItem> _items = [];
public string CustomerId { get; private set; }
public Order(
int id,
string customerId)
: base(id)
{
CustomerId = customerId;
}
public void AddItem(
string productId,
int quantity)
{
var item = new OrderItem(productId, quantity);
_items.Add(item);
RaiseDomainEvent(new OrderItemAddedEvent(Id, item));
}
}
Domain event example
public sealed class OrderItemAddedEvent
: DomainEvent
{
public int OrderId { get; }
public OrderItem Item { get; }
public OrderItemAddedEvent(
int orderId,
OrderItem item)
: base(Guid.NewGuid())
{
OrderId = orderId;
Item = item;
}
}
Value object example
public sealed class Money
: ValueObject
{
public decimal Amount { get; }
public string Currency { get; }
public Money(
decimal amount,
string currency)
{
Amount = amount;
Currency = currency;
}
public override IEnumerable<object> GetAtomicValues()
{
yield return Amount;
yield return Currency;
}
}
Single-value value objects
A value object that wraps one value (an id, a name, a code) and is stored as that value in one column implements
ISingleValueObject<TSelf, TValue>. The interface asks for what such a value object already has: TValue Value and
static Result<TSelf> Create(TValue value). Adding it to the base list is the whole change:
public sealed class PlayerId
: ValueObject,
ISingleValueObject<PlayerId, string>
{
public const int MaxLength = 50;
public string Value { get; }
private PlayerId(string value)
=> Value = value;
public static Result<PlayerId> Create(string value)
=> Result.Ensure(
value,
(v => !string.IsNullOrEmpty(v), DomainErrors.PlayerId.Empty),
(v => v.Length <= MaxLength, DomainErrors.PlayerId.TooLong(value, MaxLength)))
.Map(v => new PlayerId(v));
public override IEnumerable<object> GetAtomicValues()
{
yield return Value;
}
}
The persistence convention in Resrcify.SharedKernel.UnitOfWork (AddSingleValueObjectConversions) then stores
every property of the type as Value and reads it back with FromPersisted, which by default is
Create(value).Value: a stored value is validated again, exactly as the hand-written
HasConversion(x => x.Value, v => PlayerId.Create(v).Value) did. A value object that should read stored values
differently implements public static PlayerId FromPersisted(string value) itself. There is no base class for it:
static members can't be inherited, and a value object keeps the base it has (ValueObject).
Related modules
Resrcify.SharedKernel.UnitOfWorkconsumes domain-event abstractions in outbox interceptors.Resrcify.SharedKernel.Repositoryuses aggregate-root constraints in repository contracts.samples/Resrcify.SharedKernel.WebApiExampledemonstrates domain layer usage.
| 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
- Resrcify.SharedKernel.Abstractions (>= 4.0.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Resrcify.SharedKernel.DomainDrivenDesign:
| Package | Downloads |
|---|---|
|
Resrcify.SharedKernel.Repository
Implements a generic repository pattern using EntityFrameworkCore. |
|
|
Resrcify.SharedKernel.ArchitectureTesting
Reusable abstract architecture-test base classes built on NetArchTest. Each consumer subclasses the conventional test bases; xUnit picks up the inherited [SkippableFact] / [SkippableTheory] methods. Naming-convention auto-discovery resolves layer assemblies from the consumer's test assembly. |
|
|
Resrcify.DataProvider.Domain
Adds logic to create a slimmed down version of the GameData object used in calculations. Furthermore adds logic to expand player and datacron objects in a similar way as the SWGoH client. |
|
|
Resrcify.SharedKernel.PerformanceTests
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.0 | 24 | 10/13/2026 |
| 3.0.0 | 160 | 10/3/2026 |
| 2.2.0 | 163 | 9/13/2026 |
| 2.1.1 | 1,411 | 6/8/2026 |
| 2.1.0 | 154 | 5/24/2026 |
| 2.0.0 | 155 | 5/22/2026 |
| 1.16.3 | 274 | 5/7/2026 |
| 1.16.2 | 150 | 5/7/2026 |
| 1.16.1 | 139 | 5/7/2026 |
| 1.16.0 | 150 | 5/7/2026 |
| 1.15.0 | 214 | 4/18/2026 |
| 1.14.0 | 521 | 10/15/2025 |
| 1.13.0 | 531 | 6/27/2025 |
| 1.12.0 | 426 | 4/16/2025 |
| 1.11.0 | 306 | 4/15/2025 |
| 1.10.8 | 428 | 4/11/2025 |
| 1.10.7 | 376 | 4/9/2025 |
| 1.10.3 | 310 | 4/6/2025 |
| 1.10.2 | 276 | 4/6/2025 |
| 1.10.1 | 380 | 3/23/2025 |