Table of Contents

Class DomainEventBuilder

Namespace
Opossum.Extensions
Assembly
Opossum.dll

Fluent builder for constructing SequencedEvent instances from domain events

public class DomainEventBuilder
Inheritance
DomainEventBuilder
Inherited Members

Methods

Build()

public NewEvent Build()

Returns

NewEvent

A NewEvent ready to be appended to the event store

WithCausationId(Guid)

Sets the causation ID in the metadata

public DomainEventBuilder WithCausationId(Guid causationId)

Parameters

causationId Guid

Causation ID for tracking what caused this event

Returns

DomainEventBuilder

This builder for fluent chaining

WithCorrelationId(Guid)

Sets the correlation ID in the metadata

public DomainEventBuilder WithCorrelationId(Guid correlationId)

Parameters

correlationId Guid

Correlation ID for tracking related operations

Returns

DomainEventBuilder

This builder for fluent chaining

WithMetadata(Metadata)

Sets the metadata for the event

public DomainEventBuilder WithMetadata(Metadata metadata)

Parameters

metadata Metadata

Metadata to attach

Returns

DomainEventBuilder

This builder for fluent chaining

WithOperationId(Guid)

Sets the operation ID in the metadata

public DomainEventBuilder WithOperationId(Guid operationId)

Parameters

operationId Guid

Operation ID for tracking the operation

Returns

DomainEventBuilder

This builder for fluent chaining

WithTag(string, string)

Adds a single tag to the event

public DomainEventBuilder WithTag(string key, string value)

Parameters

key string

Tag key

value string

Tag value

Returns

DomainEventBuilder

This builder for fluent chaining

WithTags(params Tag[])

Adds multiple tags to the event

public DomainEventBuilder WithTags(params Tag[] tags)

Parameters

tags Tag[]

Tags to add

Returns

DomainEventBuilder

This builder for fluent chaining

WithTimestamp(DateTimeOffset)

Sets a custom timestamp in the metadata (defaults to UtcNow if not set)

public DomainEventBuilder WithTimestamp(DateTimeOffset timestamp)

Parameters

timestamp DateTimeOffset

Custom timestamp for the event

Returns

DomainEventBuilder

This builder for fluent chaining

WithUserId(Guid)

Sets the user ID in the metadata

public DomainEventBuilder WithUserId(Guid userId)

Parameters

userId Guid

User ID who triggered the event

Returns

DomainEventBuilder

This builder for fluent chaining

Operators

implicit operator NewEvent(DomainEventBuilder)

Implicit conversion to NewEvent for convenience

public static implicit operator NewEvent(DomainEventBuilder builder)

Parameters

builder DomainEventBuilder

Returns

NewEvent