private void WrittenConsidering(IOutcome <StorageException, Result> outcome) { outcome .AndThen(result => { if (result == Result.Success) { Written(); } return(result); }) .Otherwise(ex => { _exception.Set(ex); return(outcome.GetOrNull()); }); }
private void ReadConsidering <S>(IOutcome <StorageException, Result> outcome, S state) { outcome .AndThen(result => { if (result == Result.Success) { Read(state); } return(result); }) .Otherwise(ex => { _exception.Set(ex); return(outcome.GetOrNull()); }); }
private void AppendConsidering <TSource, TSnapshotState>(IOutcome <StorageException, Result> outcome) { outcome .AndThen(result => { if (result == Result.Success) { Appended(); } return(result); }) .Otherwise(ex => { _exception.Set(ex); return(outcome.GetOrNull()); }); }