Cayaqui.MPS.BuildingBlocks.EntityFrameworkCore
0.1.0
See the version list below for details.
dotnet add package Cayaqui.MPS.BuildingBlocks.EntityFrameworkCore --version 0.1.0
NuGet\Install-Package Cayaqui.MPS.BuildingBlocks.EntityFrameworkCore -Version 0.1.0
<PackageReference Include="Cayaqui.MPS.BuildingBlocks.EntityFrameworkCore" Version="0.1.0" />
<PackageVersion Include="Cayaqui.MPS.BuildingBlocks.EntityFrameworkCore" Version="0.1.0" />
<PackageReference Include="Cayaqui.MPS.BuildingBlocks.EntityFrameworkCore" />
paket add Cayaqui.MPS.BuildingBlocks.EntityFrameworkCore --version 0.1.0
#r "nuget: Cayaqui.MPS.BuildingBlocks.EntityFrameworkCore, 0.1.0"
#:package Cayaqui.MPS.BuildingBlocks.EntityFrameworkCore@0.1.0
#addin nuget:?package=Cayaqui.MPS.BuildingBlocks.EntityFrameworkCore&version=0.1.0
#tool nuget:?package=Cayaqui.MPS.BuildingBlocks.EntityFrameworkCore&version=0.1.0
Cayaqui.MPS.BuildingBlocks.EntityFrameworkCore
Integración EF Core para Cayaqui.MPS.BuildingBlocks. Provider-agnóstico (Relational).
Qué incluye
| Área | Tipos |
|---|---|
| Outbox | OutboxMessage, IOutboxStore/IOutboxPurgeable, EfOutboxStore<TDbContext>, OutboxMessageConfiguration, IOutboxMessageDispatcher, OutboxRedispatchHostedService<TDbContext>, OutboxPurgeHostedService<TDbContext>, OutboxHealthCheck<TDbContext> |
| Interceptors | AuditSaveChangesInterceptor (sella CreatedBy/UpdatedBy), DomainEventDispatchInterceptor (despacha eventos post-commit) |
| CQRS Blazor-safe | ScopedQueryHandler<TQuery,TResponse,TDbContext>, ScopedCommandHandler<...> — DbContext efímero por llamada vía IDbContextFactory |
| DI | AddModuleOutbox<TDbContext>(), AddOutboxBackgroundServices<TDbContext>(), AddBuildingBlocksInterceptors() |
Setup
builder.Services.AddDomainEvents(); // del paquete base
builder.Services.AddScoped<ICurrentUserService, MyCurrentUserService>();
builder.Services.AddBuildingBlocksInterceptors();
builder.Services.AddModuleOutbox<AppDbContext>();
builder.Services.AddOutboxBackgroundServices<AppDbContext>();
builder.Services.AddDbContextFactory<AppDbContext>((sp, o) =>
o.UseNpgsql(cs).AddInterceptors(
sp.GetRequiredService<AuditSaveChangesInterceptor>(),
sp.GetRequiredService<DomainEventDispatchInterceptor>()));
DbContext
protected override void OnModelCreating(ModelBuilder b)
=> b.ApplyConfiguration(new OutboxMessageConfiguration());
CQRS scoped (Blazor Server)
public sealed class GetProjectsHandler(IDbContextFactory<AppDbContext> f)
: ScopedQueryHandler<GetProjectsQuery, List<ProjectDto>, AppDbContext>(f)
{
protected override async Task<List<ProjectDto>> ExecuteAsync(AppDbContext db, GetProjectsQuery q, CancellationToken ct)
=> await db.Projects.Select(p => new ProjectDto(p)).ToListAsync(ct);
}
Usa IDbContextFactory para un DbContext efímero por llamada — seguro bajo renders concurrentes de un circuito Blazor Server.
Outbox redispatch
Implementá IOutboxMessageDispatcher (deserializa Type+Payload y publica) para activar
OutboxRedispatchHostedService. Sin esa implementación el servicio queda inactivo.
Tras MaxRetries (5) fallos un mensaje se marca IsPermanentlyFailed; OutboxHealthCheck lo reporta como Degraded.
| 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
- Cayaqui.MPS.BuildingBlocks (>= 0.1.0)
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.7)
- Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions (>= 10.0.7)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
0.1.0 — Initial release. EF Core integration for Cayaqui.MPS.BuildingBlocks: Outbox (OutboxMessage + EfOutboxStore + OutboxMessageConfiguration + redispatch/purge hosted services + health check), AuditSaveChangesInterceptor + DomainEventDispatchInterceptor, ScopedQueryHandler/ScopedCommandHandler (IDbContextFactory), AddModuleOutbox/AddOutboxBackgroundServices/AddBuildingBlocksInterceptors DI extensions.