예제 #1
0
        private Task TransformInputSource(IInputSource inputSource, List <IPipeline> pipelines)
        {
            return(Task.WhenAll(
                       inputSource
                       .Get(this)
                       .Select(i =>
            {
                foreach (var pipeline in pipelines)
                {
                    if (pipeline.Accept(this, i))
                    {
                        return pipeline.TransformAsync(this, i);
                    }
                }

                return Task.CompletedTask;
            })));
        }
예제 #2
0
        private Task <InputItems[]> PrepareInputSource(IInputSource inputSource, List <IPipeline> pipelines)
        {
            return(Task.WhenAll(
                       inputSource
                       .Get(this)
                       .Select(i =>
            {
                foreach (var pipeline in pipelines)
                {
                    if (pipeline.Accept(this, i))
                    {
                        return pipeline.PrepareAsync(this, i);
                    }
                }

                return Task.FromResult(InputItems.Empty);
            })));
        }