Cayaqui.MPS.BuildingBlocks 0.4.2

dotnet add package Cayaqui.MPS.BuildingBlocks --version 0.4.2
                    
NuGet\Install-Package Cayaqui.MPS.BuildingBlocks -Version 0.4.2
                    
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.4.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cayaqui.MPS.BuildingBlocks" Version="0.4.2" />
                    
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.4.2
                    
#r "nuget: Cayaqui.MPS.BuildingBlocks, 0.4.2"
                    
#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.4.2
                    
#: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.4.2
                    
Install as a Cake Addin
#tool nuget:?package=Cayaqui.MPS.BuildingBlocks&version=0.4.2
                    
Install as a Cake Tool

Cayaqui.MPS.BuildingBlocks

Kernel DDD/CQRS genérico para .NET 10, sin dependencia de EF Core. API fiel al MPS.SharedKernel original (apto para reemplazarlo como shim). Para la integración EF (outbox, interceptors, handlers scoped) usá Cayaqui.MPS.BuildingBlocks.EntityFrameworkCore.

Contenido

Área Tipos
Result Result<T> (where T:notnull), DomainError (+None), Unit
Invariantes DomainRuleException(DomainError), Guard (Against/AgainstNullOrWhiteSpace/AgainstNull/Found)
Entidades base AuditableEntity (Id, CreatedAt/By, UpdatedAt/By, soft-delete, buffer de eventos; AddDomainEvent protegido), ImmutableEntity
Eventos IDomainEvent, IIntegrationEvent, IDomainEventHandler<T>, IHasDomainEvents, IDomainEventDispatcher, DomainEvent, DomainEventDispatcher
Usuario actual ICurrentUserService, SystemCurrentUserService
Value objects Money, Percentage, Geocoordinate, IStronglyTypedId
Caché CacheKeyHash.OfProjectSet(...)

Result (railway)

public Result<ProjectDto> Get(Guid id)
{
    var p = _repo.Find(id);
    if (p is null) return new DomainError("NotFound", "Proyecto no existe");
    return new ProjectDto(p);  // conversión implícita a éxito
}

Invariantes (Guard → DomainRuleException)

public void Approve(string by)
{
    Guard.Against(Status != ContractStatus.Draft,
        DomainError.Conflict("Contract.NotDraft", "Solo en estado Draft."));
    Status = ContractStatus.Active;
}

Guard lanza DomainRuleException(DomainError) ante una invariante de aggregate. El companion Cayaqui.MPS.BuildingBlocks.AspNetCore la mapea a ProblemDetails por ErrorType (Conflict→409, Validation→400, NotFound→404…) en vez de un 500 genérico. Para outcomes de Application (NotFound de repositorio, autorización, orquestación) preferí Result<T> en vez de lanzar.

Entidad + evento

public sealed record ProjectCreated(Guid Id) : DomainEvent;

public sealed class Project : AuditableEntity
{
    public static Project Create()
    {
        var p = new Project();
        p.AddDomainEvent(new ProjectCreated(p.Id));  // protegido: solo la entidad emite
        return p;
    }
}

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

DomainEventDispatcher invoca todos los handlers registrados; si alguno falla, lanza AggregateException al final (señal que usa el outbox para reintentar). El despacho post-commit + persistencia transaccional se hace con el paquete EF Core.

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.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.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.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 104 6/5/2026
0.4.1 107 6/5/2026
0.4.0 161 6/4/2026
0.3.0 160 5/30/2026
0.2.0 103 5/30/2026
0.1.0 110 5/30/2026

0.4.2 — Guard con anotaciones de nulabilidad: Against([DoesNotReturnIf(true)]) + [NotNull] en AgainstNullOrWhiteSpace/AgainstNull/Found → el análisis de flujo del compilador reconoce el guard (sin CS8602/8604 tras `Guard.Against(x is null, …)`). 0.4.1 — Aditivo/no-breaking: DomainRuleException(DomainError) + Guard (Against/AgainstNullOrWhiteSpace/AgainstNull/Found) para invariantes de aggregate que lanzan un DomainError tipado; el companion AspNetCore 0.1.1 mapea la excepción a ProblemDetails por ErrorType (409/400/404…) en vez de 500. 0.4.0 — BREAKING: public namespace MPS.BuildingBlocks.* (folder-matched, ya NO MPS.SharedKernel.*) + DomainError tipado (enum ErrorType + Metadata + factories NotFound/Conflict/Validation/Unauthorized/Forbidden/Concurrency/Unexpected) — aditivo/no-breaking: `new DomainError(code,msg)` y `var (code,msg)=error` siguen válidos. 0.3.0 — namespace MPS.SharedKernel.* (shim). 0.2.0 — DDD/CQRS API: Result<T> (where T:notnull) + DomainError.None + Unit; AuditableEntity (AddDomainEvent protected, SetCreated/SetUpdated(string), SoftDelete, DomainEvents IReadOnlyList); DomainEventDispatcher con AggregateException en fallo de handler; ICurrentUserService con props no-nullable; value objects Money/Percentage/Geocoordinate (records). 0.1.0 — initial simplified release.