public void Append(string key, Action <AccountAggregateWriter> update) { _streams.Append(key, before => { var obs = new Subject <IAccountEvent>(); var ar = new AccountAggregateWriter(obs); var list = new List <IAccountEvent>(); foreach (var @event in before) { ar.Apply(@event); } using (obs.Subscribe(list.Add)) { update(ar); } return(list); }); }
public void Append(string key, Action<AccountAggregateWriter> update) { _streams.Append(key, before => { var obs = new Subject<IAccountEvent>(); var ar = new AccountAggregateWriter(obs); var list = new List<IAccountEvent>(); foreach (var @event in before) { ar.Apply(@event); } using (obs.Subscribe(list.Add)) { update(ar); } return list; }); }