Line data Source code
1 : #region Copyright
2 : // // -----------------------------------------------------------------------
3 : // // <copyright company="Chinchilla Software Limited">
4 : // // Copyright Chinchilla Software Limited. All rights reserved.
5 : // // </copyright>
6 : // // -----------------------------------------------------------------------
7 : #endregion
8 :
9 : using System;
10 : using System.Collections.Generic;
11 : using System.Runtime.Serialization;
12 : using Cqrs.Events;
13 : using Cqrs.Messages;
14 :
15 : namespace Cqrs.EventStore
16 : {
17 : /// <summary>
18 : /// An <see cref="IEvent{TAuthenticationToken}"/> that holds the event data in <see cref="Message"/>.
19 : /// </summary>
20 : /// <typeparam name="TAuthenticationToken">The <see cref="Type"/> of the authentication token.</typeparam>
21 : public class SimpleEvent<TAuthenticationToken> : IEvent<TAuthenticationToken>
22 1 : {
23 : /// <summary>
24 : /// A serialised version of one or more instances of <see cref="IEvent{TAuthenticationToken}"/>.
25 : /// </summary>
26 : [DataMember]
27 : public string Message { get; set; }
28 :
29 : #region Implementation of IEvent
30 :
31 : /// <summary>
32 : /// The ID of the <see cref="IEvent{TAuthenticationToken}"/>
33 : /// </summary>
34 : [DataMember]
35 : public Guid Id { get; set; }
36 :
37 : /// <summary>
38 : /// The version of the <see cref="IEvent{TAuthenticationToken}"/>
39 : /// </summary>
40 : [DataMember]
41 : public int Version { get; set; }
42 :
43 : /// <summary>
44 : /// The date and time the event was raised or published.
45 : /// </summary>
46 : [DataMember]
47 : public DateTimeOffset TimeStamp { get; set; }
48 :
49 : #endregion
50 :
51 : #region Implementation of IMessageWithAuthenticationToken<TAuthenticationToken>
52 :
53 : /// <summary>
54 : /// The <typeparamref name="TAuthenticationToken"/> of the entity that triggered the event to be raised.
55 : /// </summary>
56 : [DataMember]
57 : public TAuthenticationToken AuthenticationToken { get; set; }
58 :
59 : #endregion
60 :
61 : #region Implementation of IMessage
62 :
63 : /// <summary>
64 : /// An identifier used to group together several <see cref="IMessage"/>. Any <see cref="IMessage"/> with the same <see cref="CorrelationId"/> were triggered by the same initiating request.
65 : /// </summary>
66 : [DataMember]
67 : public Guid CorrelationId { get; set; }
68 :
69 : /// <summary>
70 : /// The originating framework this message was sent from.
71 : /// </summary>
72 : [DataMember]
73 : public string OriginatingFramework { get; set; }
74 :
75 : /// <summary>
76 : /// The frameworks this <see cref="IMessage"/> has been delivered to/sent via already.
77 : /// </summary>
78 : [DataMember]
79 : public IEnumerable<string> Frameworks { get; set; }
80 :
81 : #endregion
82 : }
83 : }
|