Robotico.Domain 1.0.3

Robotico.Domain

DDD building blocks for .NET 8 and .NET 10. Zero package dependencies. Provides ValueObject, Entity<TId>, and IEntity<TId> for domain-driven design.

.NET 8 .NET 10 C# GitHub Packages Build

Features

  • ValueObject — Abstract base for value objects. Override GetEqualityComponents(); equality and hashing are based on those components. Null-safe == and !=.
  • IEntity<TId> — Interface for entities with an identifier of type TId (e.g. Guid, int). Identity is the Id.
  • Entity<TId> — Abstract base implementing IEntity<TId> with equality and hashing by Id. Use when you want structural equality by identity.

Installation

dotnet add package Robotico.Domain

Quick start

Value object

using Robotico.Domain;

public sealed class Money : ValueObject
{
    public decimal Amount { get; init; }
    public string Currency { get; init; } = "USD";

    protected override IEnumerable<object?> GetEqualityComponents()
    {
        yield return Amount;
        yield return Currency;
    }
}

Money a = new() { Amount = 10m, Currency = "USD" };
Money b = new() { Amount = 10m, Currency = "USD" };
Assert.True(a == b);  // equal by components

Entity

using Robotico.Domain;

public sealed class Order : Entity<Guid>
{
    public string Number { get; init; } = string.Empty;

    public Order(Guid id, string number) : base(id)
    {
        Number = number;
    }
}

Order o1 = new Order(id, "ORD-1");
Order o2 = new Order(id, "ORD-2");
Assert.True(o1 == o2);  // same Id ⇒ same entity

When to use

  • ValueObject — For values defined by their attributes (Money, Address, DateRange). Same components ⇒ equal.
  • IEntity<TId> / Entity<TId> — For objects with stable identity (Order, User). Same Id ⇒ same entity; other attributes can change.

See the design doc (docs/design.adoc) for full guidance.

Documentation

Full contract and design: see docs/design.adoc. Detailed design docs (AsciiDoc) are in the docs/ folder:

  • Design (docs/design.adoc) — When to use ValueObject vs Entity, GetEqualityComponents, identity.

To build HTML from the AsciiDoc sources (e.g. with Asciidoctor):

asciidoctor docs/index.adoc -o docs/index.html
asciidoctor docs/design.adoc -o docs/design.html

Versioning

We follow Semantic Versioning. Version 1.0.0 is the first stable release. No breaking changes in minor/patch versions.

Building, testing, and benchmarks

From the repo root:

dotnet restore
dotnet build -c Release
dotnet test tests/Robotico.Domain.Tests/Robotico.Domain.Tests.csproj -c Release

With coverage (Coverlet):

dotnet test tests/Robotico.Domain.Tests/Robotico.Domain.Tests.csproj -c Release --collect:"XPlat Code Coverage"

Optional CI gate (fail if line coverage below threshold):

dotnet test tests/Robotico.Domain.Tests/Robotico.Domain.Tests.csproj -c Release --collect:"XPlat Code Coverage" /p:CollectCoverage=true /p:Threshold=90 /p:ThresholdType=line

Run benchmarks (BenchmarkDotNet). Recommended: run benchmarks in CI to catch performance regressions.

dotnet run --project benchmarks/Robotico.Domain.Benchmarks/Robotico.Domain.Benchmarks.csproj -c Release -f net8.0 -- --filter "*"

Or open the solution in your IDE and build from there.

License

See repository license file.

Showing the top 20 packages that depend on Robotico.Domain.

Packages Downloads
Robotico.Repository
Repository and Unit of Work interfaces for .NET. IEntity<TId>, IRepository<TEntity,TId>, IAsyncRepository<TEntity,TId>, IUnitOfWork, IUnitOfWorkCapabilities / UnitOfWorkProfile, UnitOfWorkGuard / UnitOfWorkRequirement. Depends on Robotico.Result.
9
Robotico.Repository.MishimaDb
IRepository and IUnitOfWork backed by MishimaDb using document-on-row storage (primary key + JSON payload). MishimaDbUnitOfWork coordinates a real MishimaWriteTransaction commit; pass WriteTransaction to repositories for atomic multi-write scopes.
5
Robotico.Specification
Specification pattern for .NET: composable query criteria (ISpecification<T>), And, Or, Not, ExpressionSpecification for LINQ/EF Core. Optional criteria via Robotico.Option. Aligns with Robotico.Domain (IEntity, ValueObject).
4
Robotico.Repository
Repository and Unit of Work interfaces for .NET. IEntity<TId>, IRepository<TEntity,TId>, IAsyncRepository<TEntity,TId>, IUnitOfWork, IUnitOfWorkCapabilities / UnitOfWorkProfile, UnitOfWorkGuard / UnitOfWorkRequirement. Depends on Robotico.Result.
4
Robotico.Mapper
Object-object mapping (Entity/DTO). Convention + optional config; source-generator approach. Fits Mediator and API layer; zero or minimal Robotico deps.
3
Robotico.Repository.MongoDb
IRepository and IUnitOfWork backed by MongoDB.Driver using IMongoCollection and optional IClientSessionHandle. Depends on Robotico.Repository, Robotico.Domain, Robotico.Result, MongoDB.Driver.
3
Robotico.Specification
Specification pattern for .NET: composable query criteria (ISpecification<T>), And, Or, Not, ExpressionSpecification for LINQ/EF Core. Optional criteria via Robotico.Option. Aligns with Robotico.Domain (IEntity, ValueObject).
3
Robotico.Repository.MishimaDocs
IRepository, IAsyncRepository, and IUnitOfWork backed by MishimaDocs (embedded document store). Each repository operation commits immediately when using sync collections; async writes use IMishimaAsyncCollection when the database supports async persistence. MishimaDocsUnitOfWork.CommitAsync is a no-op success for API parity; IUnitOfWorkCapabilities describes semantics.
3
Robotico.Repository.MishimaDb
IRepository and IUnitOfWork backed by MishimaDb using document-on-row storage (primary key + JSON payload). MishimaDbUnitOfWork coordinates a real MishimaWriteTransaction commit; pass WriteTransaction to repositories for atomic multi-write scopes.
3
Robotico.Repository.EntityFrameworkCore
IRepository and IUnitOfWork backed by EF Core (provider-agnostic). App adds Npgsql/SqlServer/Sqlite etc. Depends on Robotico.Repository, Robotico.Domain, Robotico.Result, Microsoft.EntityFrameworkCore.
3
Robotico.Repository.InMemory
In-memory IRepository and IUnitOfWork for tests and prototyping. Depends on Robotico.Repository, Robotico.Domain, Robotico.Result.
3
Robotico.Repository.EntityFrameworkCore
IRepository and IUnitOfWork backed by EF Core (provider-agnostic). App adds Npgsql/SqlServer/Sqlite etc. Depends on Robotico.Repository, Robotico.Domain, Robotico.Result, Microsoft.EntityFrameworkCore.
2
Robotico.Repository.InMemory
In-memory IRepository and IUnitOfWork for tests and prototyping. Depends on Robotico.Repository, Robotico.Domain, Robotico.Result.
2
Robotico.Repository.MishimaDocs
IRepository, IAsyncRepository, and IUnitOfWork backed by MishimaDocs (embedded document store). Each repository operation commits immediately when using sync collections; async writes use IMishimaAsyncCollection when the database supports async persistence. MishimaDocsUnitOfWork.CommitAsync is a no-op success for API parity; IUnitOfWorkCapabilities describes semantics.
2
Robotico.Repository.MishimaDb
IRepository and IUnitOfWork backed by MishimaDb using document-on-row storage (primary key + JSON payload). MishimaDbUnitOfWork coordinates a real MishimaWriteTransaction commit; pass WriteTransaction to repositories for atomic multi-write scopes.
2

.NET 8.0

  • No dependencies.

.NET 10.0

  • No dependencies.

Version Downloads Last updated
1.0.4 9 07/26/2026
1.0.3 10 06/03/2026