Skip to content

Latest commit

 

History

History
55 lines (40 loc) · 1.95 KB

File metadata and controls

55 lines (40 loc) · 1.95 KB

11. Architecture Packages

Optional NuGet packages that build production patterns on top of SharpCoreDB. Deep dives: docs/cqrs/README.md · docs/distributed/README.md


11.1 EventSourcing (SharpCoreDB.EventSourcing)

  • Append-only per-stream storage, global ordered feed
  • In-memory + persistent stores, snapshot policies
  • Stream replay and projections-friendly reads

11.2 Projections (SharpCoreDB.Projections)

11.3 CQRS (SharpCoreDB.CQRS)

  • Command/handler abstractions, aggregate root
  • Outbox with dead-letter workflow for reliable side-effects
  • Quick start: docs/cqrs/QUICKSTART.md
public record CreateCustomerCommand(string Name, string Email) : ICommand;

public class CreateCustomerHandler : ICommandHandler<CreateCustomerCommand>
{
    private readonly IDatabase _db;
    public CreateCustomerHandler(IDatabase db) => _db = db;

    public Task<Unit> Handle(CreateCustomerCommand cmd, CancellationToken ct)
    {
        _db.Insert("customers",
            new Dictionary<string, object> { ["name"] = cmd.Name, ["email"] = cmd.Email });
        return Unit.Task;
    }
}

11.4 Distributed (SharpCoreDB.Distributed)

11.5 Functional (SharpCoreDB.Functional)

Option<T>/Fin<T>/Seq<T> functional wrappers across adapters (see Providers). Design rationale: docs/NULLABLE_VS_OPTIONAL_REBUTTAL.md