コード例 #1
0
        public void Update(LiftAddedEvent @event)
        {
            var journey          = _journeys.Get(@event.JourneyId);
            var dateOfOccurrence = journey.DateOfOccurrence;
            var key   = new Key(new Passenger(@event.PersonId), new Month(dateOfOccurrence.Year, dateOfOccurrence.Month), new Day(dateOfOccurrence.Day));
            var value = _facts.GetOrAdd(key, () => CreateValue(dateOfOccurrence));

            _facts.Set(key, UpdateValue(value, @event));
        }
コード例 #2
0
        public void Update(JourneyCreatedEvent @event)
        {
            _journeys.Add(@event);
            var journeysOnDateOfOccurence = _journeysByDate.GetOrAdd(@event.DateOfOccurrence, () => new HashSet <JourneyCreatedEvent>());

            journeysOnDateOfOccurence.Add(@event);
            var dateOfOccurrence = @event.DateOfOccurrence;

            foreach (var factEntry in _facts.Retrieve().Where(f => f.Key.Day.DayOfMonth == dateOfOccurrence.Day && f.Key.Month.MonthOfYear == dateOfOccurrence.Month && f.Key.Month.Year == dateOfOccurrence.Year).ToList())
            {
                _facts.Set(factEntry.Key, UpdateValue(factEntry.Value, @event));
            }
        }