forked from kurrent-io/KurrentDB
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEventData.cs
More file actions
54 lines (48 loc) · 1.88 KB
/
EventData.cs
File metadata and controls
54 lines (48 loc) · 1.88 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
namespace EventStore.ClientAPI
{
/// <summary>
/// Represents an event to be written.
/// </summary>
public sealed class EventData
{
/// <summary>
/// The ID of the event, used as part of the idempotent write check.
/// </summary>
public readonly Guid EventId;
/// <summary>
/// The name of the event type. It is strongly recommended that these
/// use lowerCamelCase if projections are to be used.
/// </summary>
public readonly string Type;
/// <summary>
/// Flag indicating whether the data and metadata are JSON.
/// </summary>
public readonly bool IsJson;
/// <summary>
/// The raw bytes of the event data.
/// </summary>
public readonly byte[] Data;
/// <summary>
/// The raw bytes of the event metadata.
/// </summary>
public readonly byte[] Metadata;
/// <summary>
/// Constructs a new <see cref="EventData" />.
/// </summary>
/// <param name="eventId">The ID of the event, used as part of the idempotent write check.</param>
/// <param name="type">The name of the event type. It is strongly recommended that these
/// use lowerCamelCase if projections are to be used.</param>
/// <param name="isJson">Flag indicating whether the data and metadata are JSON.</param>
/// <param name="data">The raw bytes of the event data.</param>
/// <param name="metadata">The raw bytes of the event metadata.</param>
public EventData(Guid eventId, string type, bool isJson, byte[] data, byte[] metadata)
{
EventId = eventId;
Type = type;
IsJson = isJson;
Data = data ?? Empty.ByteArray;
Metadata = metadata ?? Empty.ByteArray;
}
}
}