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 Cqrs.Events;
11 :
12 : namespace Cqrs.MongoDB.Serialisers
13 : {
14 : /// <summary>
15 : /// Builds <see cref="EventData"/> from various input formats leaving the event data unserialised.
16 : /// </summary>
17 : /// <typeparam name="TAuthenticationToken">The <see cref="Type"/> of the authentication token.</typeparam>
18 : public class MongoDbEventBuilder<TAuthenticationToken>
19 : : DefaultEventBuilder<TAuthenticationToken>
20 1 : {
21 : #region Overrides of EventBuilder<TAuthenticationToken>
22 :
23 : /// <summary>
24 : /// Create an <see cref="EventData">framework event</see> with the provided <paramref name="eventData"/>.
25 : /// </summary>
26 : /// <param name="type">The name of the <see cref="Type"/> of the target object the serialised data is.</param>
27 : /// <param name="eventData">The <see cref="IEvent{TAuthenticationToken}"/> to add to the <see cref="EventData"/>.</param>
28 1 : public override EventData CreateFrameworkEvent(string type, IEvent<TAuthenticationToken> eventData)
29 : {
30 : return new EventData
31 : {
32 : EventId = Guid.NewGuid(),
33 : EventType = type,
34 : Data = eventData
35 : };
36 : }
37 :
38 : #endregion
39 : }
40 : }
|