Ejemplo n.º 1
0
        public IObservable <DealRowViewModel> GetAllDealUpdates()
        {
            //Will read all events from the system and filter non-deal streams.
            //var allDealEvents = _eventStoreClient.AllEvents()
            //    .Where(re => StreamNames.IsDealStream(re.Event.EventStreamId));
            //-Or-
            //--Requires the system Category projection to be started. hre $ce-* is a logical CategoryEvent system stream of anything starting with "Deal-"
            var allDealEvents = _eventStoreClient.GetEvents("$ce-Deal");

            return(allDealEvents
                   .GroupBy(re => re.Event.EventStreamId)
                   .SelectMany(dealStream => dealStream
                               .Scan <ResolvedEvent, DealRowViewModel>(null, AccumlateDealEvents)));
        }
Ejemplo n.º 2
0
 public static IObservable <T> GetEvents <T>(this IEventStoreClient eventStoreClient, string streamName)
 {
     return(eventStoreClient.GetEvents(streamName)
            .Select(re => Encoding.UTF8.GetString(re.OriginalEvent.Data))
            .Select(JsonConvert.DeserializeObject <T>));
 }