コード例 #1
0
ファイル: EventStore.cs プロジェクト: virajs/DDD.Light
        public DateTime LatestEventTimestamp <TId>(TId aggregateId)
        {
            VerifyRepoIsConfigured();
            var aggregateEvents = _repo.Get().Where(x => _serializationStrategy.DeserializeEvent(x.SerializedAggregateId, Type.GetType(x.AggregateIdType)).Equals(aggregateId)).OrderByDescending(x => x.CreatedOn);

            return(aggregateEvents.Any() ? aggregateEvents.First().CreatedOn : new DateTime());
        }
コード例 #2
0
        private void HandleRestoreReadModelEvent(AggregateEvent aggregateEvent)
        {
            var eventType = Type.GetType(aggregateEvent.EventType);
            var @event    = _eventSerializationStrategy.DeserializeEvent(aggregateEvent.SerializedEvent, eventType);

            GetType().GetMethod("HandleEvent", BindingFlags.NonPublic | BindingFlags.Instance)
            .MakeGenericMethod(eventType)
            .Invoke(Instance, new[] { @event });
        }