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()
Builds the final NewEvent ready to be passed to AppendAsync(NewEvent[], AppendCondition?, CancellationToken).
public NewEvent Build()
Returns
WithCausationId(Guid)
Sets the causation ID in the metadata
public DomainEventBuilder WithCausationId(Guid causationId)
Parameters
causationIdGuidCausation 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
correlationIdGuidCorrelation 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
metadataMetadataMetadata to attach
Returns
- DomainEventBuilder
This builder for fluent chaining
WithOperationId(Guid)
Sets the operation ID in the metadata
public DomainEventBuilder WithOperationId(Guid operationId)
Parameters
operationIdGuidOperation 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
Returns
- DomainEventBuilder
This builder for fluent chaining
WithTags(params Tag[])
Adds multiple tags to the event
public DomainEventBuilder WithTags(params Tag[] tags)
Parameters
tagsTag[]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
timestampDateTimeOffsetCustom 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
userIdGuidUser 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
builderDomainEventBuilder