Cayaqui.MPS.BuildingBlocks
0.1.0
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
<PackageReference Include="Cayaqui.MPS.BuildingBlocks" Version="0.1.0" />
<PackageVersion Include="Cayaqui.MPS.BuildingBlocks" Version="0.1.0" />
<PackageReference Include="Cayaqui.MPS.BuildingBlocks" />
paket add Cayaqui.MPS.BuildingBlocks --version 0.1.0
#r "nuget: Cayaqui.MPS.BuildingBlocks, 0.1.0"
#:package Cayaqui.MPS.BuildingBlocks@0.1.0
#addin nuget:?package=Cayaqui.MPS.BuildingBlocks&version=0.1.0
#tool nuget:?package=Cayaqui.MPS.BuildingBlocks&version=0.1.0
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 enCayaqui.MPS.Helpers(con foco en formateo). A futuroBuildingBlockses el origen canónico para los value objects de dominio;Helpersconservará sólo las extensiones de formateo. Evitá referenciar ambosMoneyen el mismo archivo.
| 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
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.7)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.7)
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.
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.