-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathEvent.cs
More file actions
36 lines (29 loc) · 982 Bytes
/
Event.cs
File metadata and controls
36 lines (29 loc) · 982 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (c) TotalSoft.
// This source code is licensed under the MIT license.
using MediatR;
using System;
namespace NBB.Application.DataContracts
{
[Obsolete("Ensures NBB4 compatibility. Use INotification instead.")]
public abstract class Event : INotification
{
public EventMetadata Metadata { get; }
protected Event(EventMetadata metadata = null)
{
Metadata = metadata ?? EventMetadata.Default();
}
public Guid EventId => Metadata.EventId;
}
[Obsolete("Ensures NBB4 compatibility")]
public class EventMetadata
{
public Guid EventId { get; }
public DateTime CreationDate { get; }
public EventMetadata(Guid eventId, DateTime creationDate)
{
EventId = eventId;
CreationDate = creationDate;
}
public static EventMetadata Default() => new(Guid.NewGuid(), DateTime.UtcNow);
}
}