EventActionsType

PackageFCQRS
C#-friendly factory methods for EventAction

Specification

Kind
Type
Members
7
Examples
0
DeferSignature
EventActions.Defer(event)
DispatchSignature
EventActions.Dispatch(description)
IgnoreSignature
EventActions.Ignore()
PersistSignature
EventActions.Persist(event)
PersistAllSignature
EventActions.PersistAll(events)

Summary

NameSignatureSynopsis
DeferEventActions.Defer(event)Create a DeferEvent action.
DispatchEventActions.Dispatch(description)Create a RunAsync effect (a "mini saga" without persistence) from an INSPECTABLE description object.
IgnoreEventActions.Ignore()Create an IgnoreEvent action (command is ignored, no event produced)
PersistEventActions.Persist(event)Create a PersistEvent action (event will be persisted and published)
PersistAllEventActions.PersistAll(events)Create a PersistAllEvents action: all events from this command persist as one journal AtomicWrite (all-or-nothing), with sequential versions.
PersistAndSnapshotEventActions.PersistAndSnapshot(event)Create a PersistAndSnapshot action: persist the event, then save a manual snapshot once it is durable - independent of the SnapshotPolicy cadence.
PersistConditionallyEventActions.PersistConditionally(shouldPersist, event)Persist the event when `shouldPersist` is true; otherwise Defer it - the event is still published and folded but is not written to the journal or sent through a projection.

Defer

EventActions.Defer(event)
Member
Create a DeferEvent action. The event is published and folded but not persisted. Rejection and idempotent-reply folds should preserve state, because recovery cannot replay a deferred event.

Parameters

NameTypeDescription
event'TEvent

Returns

EventAction<'TEvent>

Dispatch

EventActions.Dispatch(description)
Member
Create a RunAsync effect (a "mini saga" without persistence) from an INSPECTABLE description object. The runner registered via `InitAggregateWithEffects` executes it and self-dispatches the resulting command. EPHEMERAL (not journaled, so a crash mid-flight loses it) and TOTAL (the runner must map failure to a command). See EventAction.RunAsync.

Parameters

NameTypeDescription
descriptionobj

Returns

EventAction<'TEvent>

Ignore

EventActions.Ignore()
Member
Create an IgnoreEvent action (command is ignored, no event produced)

Returns

EventAction<'TEvent>

Persist

EventActions.Persist(event)
Member
Create a PersistEvent action (event will be persisted and published)

Parameters

NameTypeDescription
event'TEvent

Returns

EventAction<'TEvent>

PersistAll

EventActions.PersistAll(events)
Member
Create a PersistAllEvents action: all events from this command persist as one journal AtomicWrite (all-or-nothing), with sequential versions. State updates and publishes happen only after the whole batch is durable.

Parameters

NameTypeDescription
events'TEvent[]

Returns

EventAction<'TEvent>

PersistAndSnapshot

EventActions.PersistAndSnapshot(event)
Member
Create a PersistAndSnapshot action: persist the event, then save a manual snapshot once it is durable - independent of the SnapshotPolicy cadence.

Parameters

NameTypeDescription
event'TEvent

Returns

EventAction<'TEvent>

PersistConditionally

EventActions.PersistConditionally(shouldPersist, event)
Member
Persist the event when `shouldPersist` is true; otherwise Defer it - the event is still published and folded but is not written to the journal or sent through a projection. Its fold should preserve the current state. The idempotent "emit this verdict, but only write it once" shape, e.g. re-approving an already-approved aggregate: `PersistConditionally(state.Approval != Approved, new Approved(id))`.

Parameters

NameTypeDescription
shouldPersistbool
event'TEvent

Returns

EventAction<'TEvent>