示例#1
0
        public static OutputPipe <TOutput> BuildMapping <TInput, TOutput>(
            this IOutputPipe <TInput> pipe,
            Func <IMappingBuilder <TInput>, Func <TInput, TOutput> > builder)
            where TInput : class
            where TOutput : class
        {
            var mappingBuilder = pipe.GetService <IMappingBuilder <TInput> >();

            return(pipe.Map(builder(mappingBuilder)));
        }
示例#2
0
        public static OutputPipe <TOutput> UseMapper <TInput, TOutput>(
            this IOutputPipe <TInput> pipe,
            Func <IMapperFactory <TInput>, IMapper <TInput, TOutput> > selection)
            where TInput : class
            where TOutput : class
        {
            var mapper = pipe.GetService <IMapperFactory <TInput> >();

            return(pipe.Map(i => selection(mapper).Map(i)));
        }
示例#3
0
 public static OutputPipe <TOutput> Map <TInput, TOutput>(
     this IOutputPipe <TInput> pipe, Func <TInput, TOutput> mapping)
     where TInput : class
     where TOutput : class =>
 pipe.Map(i => Task.FromResult(mapping(i)));