Header menu logo FCQRS

CSharp Module

C# interoperability helpers for FCQRS Provides simpler APIs for consuming FCQRS from C#

Types

Type Description

ActorApi

C#-friendly Actor API

ActorWiring

Low-level wiring over an IActor: register the saga-starter, aggregates and actors, and send commands. Most members are plain static helpers (you call ActorWiring.Foo(actor, …)); a couple are genuine extension methods. For app composition, prefer the host-builder API (AddFcqrs/AddAggregate/AddSaga).

Aggregate<'TState, 'TCommand, 'TEvent>

C#-friendly abstract base for an event-sourced aggregate. A concrete aggregate supplies only InitialState, EntityName, HandleCommand (the decision) and ApplyEvent (the fold); the base provides the wiring (Init). Designed to be subclassed from C#.

AggregateFactory

C# delegate for an aggregate's entity-ref factory: an id -> its sharded actor ref. sp.AggregateFactory<T>() returns one; sagas use it to target an aggregate.

AggregateRefs<'TCommand, 'TEvent>

The two C#-facing pieces of a wired aggregate: a Factory for entity refs (used by sagas to target the aggregate) and a Handler to send a command and await its event (used by the delivery layer). Returned by InitAggregate.

Describe

Diagnostics helper: a short, readable case name for logging. Unwraps a Command<_>/Event<_> envelope to its payload (via IEnvelope), then a C# `union` to its active case (its generated `.Value`), and falls back to the type name — so F# DUs and plain payloads work too. Reflection-based; meant for logs, not hot paths.

EventActions

C#-friendly factory methods for EventAction

FSharpResults

C#-friendly factory methods for constructing an F# Result (Ok/Error) from C#.

Handler<'TCmd, 'TEvent>

C# delegate for command handlers - returns Task>

ISubscribeExtensions

Extension methods for ISubscribe

JournalTypeMapBuilder

Fluent registrar for stable journal type names (see JournalTypes).

PrefixConversions

C#-friendly factory for PrefixConversion

QueryApi

C#-friendly Query API

Saga<'TEvent, 'TSagaData, 'TState>

C#-friendly abstract base for a saga. A concrete saga supplies InitialData, SagaName, Originator (the aggregate it starts from), HandleEvent and ApplySideEffects; the base provides the wiring (Init/Factory) and the small transition DSL. Designed to be subclassed from C#.

SagaApi

Low-level C# saga API (mirrors ActorApi/QueryApi). For most sagas, prefer the Saga<_,_,_> base class, which wraps this.

SagaCommands

C#-friendly saga command targeting

SagaDefinition

C#-friendly class for defining saga starters (uses class for C# object initializer syntax)

SagaEventActions

C#-friendly factory methods for saga EventAction

SagaSideEffectResult<'TState>

C#-friendly result type for saga side effects (uses class for C# object initializer syntax)

SagaStates

C#-friendly helpers for SagaState

SagaTransitions

C#-friendly factory methods for SagaTransition

TestEnvelope

C#-friendly builders for the Command/Event envelopes that the pure handleCommand/applyEvent functions expect. Intended for unit tests: the envelope's plumbing fields (a fresh MessageId/CID, a UTC timestamp, no sender, empty metadata) are filled in for you, so a test supplies only the payload — and, for events, the aggregate version. The framework builds these envelopes itself at runtime; tests are the one place you build them by hand.

Values

Factory methods for creating FCQRS's strongly-typed value/identifier types (CID, AggregateId, MessageId, ShortString, LongString, Version) from C#.

Type something to start searching.