public UserAR(Snapshot snapshot, TransitionStream stream)
 {
     _state = snapshot != null ? (UserState)snapshot.Payload : new UserState();
     foreach (var transition in stream.Read())
     {
         foreach (var @event in transition.Events)
         {
             _state.Mutate((IEvent)@event.Data);
         }
     }
 }
예제 #2
0
 public static int GetVersion(this TransitionStream stream)
 {
     return(stream.Read().Any() ? stream.Read().Max(x => x.Id.Version) : 0);
 }