private IEnumerator SimpleSaga() { var data = new Ref <int>(); yield return(Do.Call(TestCallMethod, data)); yield return(Do.Put(new SagaAction <int>("test", data.Value))); }
private IEnumerator DoStuff(Ref <int> data, bool fireException) { CallEffect <int> .CallTarget target = TestCallMethod; if (fireException == false) { target = TestCallMethodNoException; } yield return(Do.Call(target, data)); yield return(Do.Put(new SagaAction <int>("success", data.Value))); }
public Result <None> CreateTagCloudImage() { var tagCloudContext = cloudContextGenerator.GetTagCloudContext(); var shuffledContentStrings = tagCloudContext .SelectValue(context => (preprocessor: vocabularyPreprocessorConstructor(context), cloudContent: context.TagCloudContent)) .SelectValue(tuple => tuple.preprocessor.Process(tuple.cloudContent)) .SelectValue(words => words.SequenceShuffle(new Random())) .SelectValue(words => words.Distinct()) .SelectValue(words => words.ToArray()); var layouter = tagCloudContext.SelectValue(context => context.CloudLayouter); var size = tagCloudContext.SelectValue(context => context.ImageSize); var imageName = tagCloudContext.SelectValue(context => context.ImageName); return(tagCloudContext .Then(context => Do.Call <string[], ICloudLayouter, Size, Result <Bitmap> >(context.Cloud.CreateBitmap) .With(shuffledContentStrings, layouter, size)) .ActionOverValue(bitmap => Do.Call <string>(bitmap.Save).With(imageName)) .ReplaceError(error => $"Bitmap creation error was handled:{Environment.NewLine}{error}")); }