Headless CMS and Content Managment Hub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

28 lines
843 B

// ==========================================================================
// Envelope.cs
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex Group
// All rights reserved.
// ==========================================================================
using System;
using NodaTime;
namespace Squidex.Infrastructure.CQRS.Events
{
public static class Envelope
{
public static Envelope<IEvent> Create<TPayload>(TPayload payload) where TPayload : IEvent
{
var eventId = Guid.NewGuid();
var envelope =
new Envelope<IEvent>(payload)
.SetEventId(eventId)
.SetTimestamp(SystemClock.Instance.GetCurrentInstant());
return envelope;
}
}
}