예제 #1
0
        /// <summary>
        /// Returns all events which matches the given <paramref name="aggregateId" /> from the internal storage
        /// </summary>
        /// <param name="aggregateId">The Id of the aggreate to query the document data store</param>
        /// <returns>A list with all events</returns>
        public IEnumerable <IDomainEvent> Find(Guid aggregateId)
        {
            List <IDomainEvent> events = null;

            using (new TimeMeasure(ms => _performanceMeasurementService.CountDocumentDatabaseEventStoreRead(events.Count)))
            {
                events = _documentStoreCache.Get(aggregateId).ToList();

                if (!events.Any())
                {
                    events = _persistentEventStore.Find(aggregateId).ToList();
                }

                return(events);
            }
        }
예제 #2
0
 /// <summary>
 /// Returns all events which aggregateId matches the given <paramref name="aggregateId" />.
 /// </summary>
 /// <param name="aggregateId">The identifier by an aggregate</param>
 /// <returns>A list with all events</returns>
 public IEnumerable <IDomainEvent> GetEventsByAggregateId(Guid aggregateId)
 {
     return(_persistentEventStore.Find(aggregateId));
 }