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()); }
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 }); }