Cayaqui.MPS.BuildingBlocks 0.1.0

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

Cayaqui.MPS.BuildingBlocks

Bloques DDD/CQRS genéricos y agnósticos de dominio para .NET 10. Sin dependencia de EF Core. Para la integración EF (Outbox, interceptors, handlers scoped) usá Cayaqui.MPS.BuildingBlocks.EntityFrameworkCore.

Qué incluye

Área Tipos
Result Result, Result<T>, DomainError, Unit (railway-oriented, sin excepciones para errores de negocio)
Entidades base AuditableEntity (Id, CreatedAt/By, UpdatedAt/By, soft-delete, buffer de eventos), ImmutableEntity
Eventos de dominio IDomainEvent, IIntegrationEvent, IDomainEventHandler<T>, IHasDomainEvents, IDomainEventDispatcher, DomainEvent, DomainEventDispatcher
Usuario actual ICurrentUserService, SystemCurrentUserService (fallback sin HTTP)
Value objects Money, Percentage, Geocoordinate, IStronglyTypedId
Caché CacheKeyHash.OfProjectSet(...)
DI AddDomainEvents(), AddDomainEventHandlersFromAssembly(asm)

Setup

builder.Services.AddDomainEvents();
builder.Services.AddDomainEventHandlersFromAssembly(typeof(MyHandler).Assembly);

Eventos de dominio

public sealed record ProjectCreated(Guid ProjectId) : DomainEvent;

public sealed class Project : AuditableEntity
{
    public static Project Create() { var p = new Project(); p.Raise(new ProjectCreated(p.Id)); return p; }
}

public sealed class OnProjectCreated : IDomainEventHandler<ProjectCreated>
{
    public Task HandleAsync(ProjectCreated e, CancellationToken ct = default) { /* ... */ return Task.CompletedTask; }
}

El despacho post-commit se hace con DomainEventDispatchInterceptor del paquete EF Core.

Result

public Result<ProjectDto> GetProject(Guid id)
{
    var p = _repo.Find(id);
    if (p is null) return DomainError.NotFound("Proyecto");
    return new ProjectDto(p);   // conversión implícita a Result<T>.Success
}

IDs fuertemente tipados

public readonly record struct ProjectId(Guid Value) : IStronglyTypedId
{
    public static ProjectId New() => new(Guid.CreateVersion7());
    public static ProjectId From(Guid value) => new(value);
}

Nota de consolidación: Money/Result<T> también existen en Cayaqui.MPS.Helpers (con foco en formateo). A futuro BuildingBlocks es el origen canónico para los value objects de dominio; Helpers conservará sólo las extensiones de formateo. Evitá referenciar ambos Money en el mismo archivo.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on Cayaqui.MPS.BuildingBlocks:

Package Downloads
Cayaqui.MPS.BuildingBlocks.EntityFrameworkCore

EF Core integration for Cayaqui.MPS.BuildingBlocks: transactional Outbox (EfOutboxStore with Postgres FOR UPDATE SKIP LOCKED + redispatch/purge hosted services + multi-store health check), audit + domain-event-dispatch SaveChanges interceptors, and Blazor Server-safe scoped CQRS handlers (ScopedQueryHandler/ScopedCommandHandler over IDbContextFactory returning Result<T>). Proprietary — requires a commercial agreement with Cayaqui.

Cayaqui.MPS.BuildingBlocks.AspNetCore

ASP.NET Core companion for Cayaqui.MPS.BuildingBlocks: maps Result<T>/DomainError to RFC7807 ProblemDetails by ErrorType, provides a global IExceptionHandler (500 + traceId) and AddMpsErrorHandling DI wiring. Requires a commercial agreement with Cayaqui.

Cayaqui.MPS.Cqrs

CQRS handler-pipeline decorators (logging) for the MPS IHandler. Contains LoggingHandlerDecorator<TIn, TResult> which wraps any IHandler<TIn, Result<TResult>> with structured logging of entry/success/failure/exceptions. Kept separate from Cayaqui.MPS.Abstractions so that the zero-dependency core is preserved. Proprietary — requires a commercial agreement with Cayaqui.

Cayaqui.MPS.Abstractions.Validation

FluentValidation cross-cutting decorator for the MPS CQRS IHandler pipeline. Wraps any IHandler<TIn, Result<TResult>> with an optional IValidator<TIn>; on validation failure returns a typed DomainError (ErrorType.Validation) with per-field Metadata — no control-flow exceptions. Kept as a separate package so FluentValidation is not forced on zero-dep consumers of Cayaqui.MPS.Abstractions. Proprietary — requires a commercial agreement with Cayaqui.

Cayaqui.MPS.ApiClient

Result-based typed HTTP client for consuming MPS APIs from Blazor/MAUI/any .NET. Mirrors the companion server error contract (ProblemDetails ↔ Result<DomainError>): the API serializes DomainError→ProblemDetails, this package deserializes ProblemDetails→Result<T>.Failure(DomainError). Provides IBaseApiService marker + BaseApiService verb-helpers (Get/Post/Put/Delete → Result<T>, never throws on business errors), IAccessTokenProvider + BearerTokenHandler for reusable auth. Zero ASP.NET dependency. Proprietary — requires a commercial agreement with Cayaqui.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.4.2 206 6/5/2026
0.4.1 205 6/5/2026
0.4.0 257 6/4/2026
0.3.0 167 5/30/2026
0.2.0 110 5/30/2026
0.1.0 118 5/30/2026

0.1.0 — Initial release. Railway Result<T>/DomainError/Unit, AuditableEntity/ImmutableEntity, in-process domain events (IDomainEvent/IDomainEventHandler/IDomainEventDispatcher + DomainEventDispatcher), ICurrentUserService + SystemCurrentUserService, value objects (Money, Percentage, Geocoordinate), CacheKeyHash, AddDomainEvents DI extension.