Exemple #1
0
        private static DocumentDbAggregateEvent CreateDocumentDbEvent(Aggregate aggregate, IEvent @event, int commitNumber)
        {
            var docStoreEvent = new DocumentDbAggregateEvent
            {
                Id            = @event.CorrelationId,
                AggregateId   = aggregate.Id,
                ClrType       = GetClrTypeName(@event),
                Version       = commitNumber,
                TargetVersion = @event.TargetVersion,
                Timestamp     = @event.EventCommittedTimestamp,
                Data          = SerializeEvent(@event)
            };

            return(docStoreEvent);
        }
Exemple #2
0
        protected static IEvent DeserializeEvent(DocumentDbAggregateEvent returnedAggregateEvent)
        {
            var returnType = Type.GetType(returnedAggregateEvent.ClrType);

            return((Event)JsonConvert.DeserializeObject(returnedAggregateEvent.Data, returnType, SerializerSettings));
        }