Table of Contents

DomainEventExtensions Class

Definition

Namespace
Savvyio.Domain
Assemblies
Savvyio.Domain.dll
Source
src/Savvyio.Domain/DomainEventExtensions.cs

Extension methods for the IDomainEvent interface.

public static class DomainEventExtensions
Inheritance
DomainEventExtensions

Examples

This example shows how to stamp a domain event with envelope metadata and read the event identifier and timestamp later.

using System;
using Savvyio;
using Savvyio.Domain;

namespace ExampleApp;

public sealed class DomainEventExtensionsExample
{
    public (string EventId, DateTime Timestamp) Describe()
    {
        var e = new AccountOpenedEvent("ACC-42").SetEventId("evt-42").SetTimestamp(new DateTime(2026,7,1,0,0,0,DateTimeKind.Utc));
        return (e.GetEventId(), e.GetTimestamp());
    }
}

public sealed record AccountOpenedEvent(string AccountId) : Request, IDomainEvent;

Methods

Name Description
GetEventId<T>(T)

Gets the string representation of the event identifier from the request.

GetTimestamp<T>(T)

Gets the DateTime value of the timestamp from the request.