public static Task <IActionResult> ToOptionsResult <TInput>( this IOutputPipe <TInput> pipe, params HttpVerb[] verbs) where TInput : class { var httpContextStorage = pipe.GetService <IScopedStorage <HttpContext> >(); var httpVerbMap = pipe.GetService <IHttpVerbMap>(); IPipe resultPipe = new OptionsResultPipe <TInput>( input => verbs, httpVerbMap, httpContextStorage, pipe); return(resultPipe.Execute()); }
public static Task <IActionResult> ToOptionsResult <TInput>( this IOutputPipe <TInput> pipe, Func <IAllowedOptionsBuilder <TInput>, IAllowedOptionsBuilder <TInput> > builder) where TInput : class { var allowedOptionsBuilder = pipe.GetService <IAllowedOptionsBuilder <TInput> >(); var httpContextStorage = pipe.GetService <IScopedStorage <HttpContext> >(); var httpVerbMap = pipe.GetService <IHttpVerbMap>(); IPipe resultPipe = new OptionsResultPipe <TInput>( input => builder(allowedOptionsBuilder).GenerateAllowedVerbs(input), httpVerbMap, httpContextStorage, pipe); return(resultPipe.Execute()); }
public static OutputPipe <TEntity> InvalidWhen <TEntity>( this IOutputPipe <TEntity> pipe, Func <TEntity, Task <bool> > invalidCheck, int statusCode, object error = null) where TEntity : class => pipe.GetService <IEntityValidationPipeFactory <TEntity> >() .Resolve(invalidCheck, statusCode, error, pipe);
public static OutputPipe <IQueryable <TInput> > ApplyOrderByClientRequest <TInput>( this IOutputPipe <IQueryable <TInput> > pipe, Func <IOrderByExpressionBuilder <TInput>, IOrderByExpressionBuilder <TInput> > builder) { var orderByExpressionBuilder = pipe.GetService <IOrderByExpressionBuilder <TInput> >(); return(pipe.ApplyOrderByClientRequest(builder(orderByExpressionBuilder).Build())); }
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))); }
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))); }
public static OutputPipe <RestEntityCollection> BuildMappingForCollection <TInput, TOutput>( this IOutputPipe <IQueryable <TInput> > pipe, Func <IMappingBuilder <TInput>, Func <TInput, TOutput> > builder) where TInput : class where TOutput : class { var transformerBuilder = pipe.GetService <IMappingBuilder <TInput> >(); return(pipe.MapToRestCollection(builder(transformerBuilder))); }
public static OutputPipe <RestEntityCollection> UseMapperForCollection <TInput, TOutput>( this IOutputPipe <IQueryable <TInput> > pipe, Func <IMapperFactory <TInput>, IMapper <TInput, TOutput> > selection) where TInput : class where TOutput : class { var transformer = pipe.GetService <IMapperFactory <TInput> >(); return(pipe.MapToRestCollection(i => selection(transformer).Map(i))); }
public static OutputPipe <TInput> Do <TInput>( this IOutputPipe <TInput> pipe, Action <TInput> action) where TInput : class { Func <TInput, Task> asyncAction = entity => { action(entity); return(Task.FromResult(0)); }; return(pipe.GetService <IActionPipeFactory <TInput> >().Resolve(asyncAction, pipe)); }
public static OutputPipe <TInput> SingleOrDefault <TInput>( this IOutputPipe <IQueryable <TInput> > pipe, Expression <Func <TInput, bool> > predicate) where TInput : class => pipe.GetService <ISingleOrDefaultPipeFactory <TInput> >().Resolve(predicate, pipe);
public static OutputPipe <TOutputQueryable> MapQueryable <TInputQueryable, TOutputQueryable>( this IOutputPipe <TInputQueryable> pipe, Func <TInputQueryable, TOutputQueryable> mapping) where TInputQueryable : class, IQueryable where TOutputQueryable : class, IQueryable => pipe.GetService <IQueryablePipeFactory <TInputQueryable, TOutputQueryable> >() .Resolve(mapping, pipe);
public static OutputPipe <IQueryable <TInput> > ApplySearchByClientRequest <TInput>( this IOutputPipe <IQueryable <TInput> > pipe, Func <string, Expression <Func <TInput, bool> > > search) => pipe.GetService <ISearchByClientRequestPipeFactory <TInput> >() .Resolve(search, pipe);
public static OutputPipe <TInput> Do <TInput>( this IOutputPipe <TInput> pipe, Func <TInput, Task> action) where TInput : class => pipe.GetService <IActionPipeFactory <TInput> >().Resolve(action, pipe);
public static OutputPipe <IQueryable <TInput> > ApplyPaginationByClientRequest <TInput>( this IOutputPipe <IQueryable <TInput> > pipe, PaginationOptions options = null) => pipe.GetService <IPaginationByClientRequestPipeFactory <TInput> >() .Resolve(options, pipe);
public static OutputPipe <IQueryable <TInput> > ApplyOrderByClientRequest <TInput>( this IOutputPipe <IQueryable <TInput> > pipe, IDictionary <string, IOrderByExpressionFactory <TInput> > orderByExpressions) => pipe.GetService <IOrderByClientRequestPipeFactory <TInput> >() .Resolve(orderByExpressions, pipe);
public static OutputPipe <IQueryable <TInput> > ApplyFilterByClientRequest <TInput>( this IOutputPipe <IQueryable <TInput> > pipe, IDictionary <string, IFilterExpressionProvider <TInput> > filterExpressionProviders) => pipe.GetService <IFilterByClientRequestPipeFactory <TInput> >() .Resolve(filterExpressionProviders, pipe);