Пример #1
0
        public void Save(Type aggregateRootType, IEvent <TAuthenticationToken> @event)
        {
            EventData eventData  = EventBuilder.CreateFrameworkEvent(@event);
            string    streamName = string.Format(CqrsEventStoreStreamNamePattern, aggregateRootType.FullName, @event.Id);

            using (EventStoreTransaction transaction = EventStoreConnection.StartTransactionAsync(streamName, ExpectedVersion.Any).Result)
            {
                WriteResult saveResult   = EventStoreConnection.AppendToStreamAsync(streamName, ExpectedVersion.Any, new[] { eventData }).Result;
                WriteResult commitResult = transaction.CommitAsync().Result;
            }
        }