/// <summary> /// Initializes a new instance of the <see cref="MultipleResultSetTransformProxy{TFilter}"/> class. /// </summary> /// <param name="source">The source.</param> /// <param name="transforms">The transforms.</param> public MultipleResultSetTransformProxy(IMultipleResultSetCommandProcessor <TFilter> source, IEnumerable <CommandTransform> transforms, Action <IExecutableCommandInfo> queryInspector = null) : base(source) { _transforms = transforms; _queryInspector = queryInspector ?? new Action <IExecutableCommandInfo>((info) => { }); }
/// <summary> /// Applies a set of transforms to future executions. /// </summary> /// <typeparam name="TFilter">The type of the filter.</typeparam> /// <param name="source">The source.</param> /// <param name="transforms">The transforms.</param> /// <returns>INoResultCommandProcessor<TFilter, TResult>.</returns> /// <exception cref="ArgumentNullException">At least one transform is required.</exception> public static IMultipleResultSetCommandProcessor <TFilter> ApplyTransforms <TFilter>( this IMultipleResultSetCommandProcessor <TFilter> source, Func <IMultipleResultSetCommandProcessor <TFilter>, IEnumerable <CommandTransform> > transforms) { if (transforms == null) { throw new ArgumentNullException(nameof(transforms), "At least one transform is required."); } return(source.InterceptOrProxyWith(s => new MultipleResultSetTransformProxy <TFilter>(s, transforms(s)))); }
/// <summary> /// Allows providing an action which is executed against any execution exceptions. /// </summary> /// <typeparam name="TFilter">The type of the filter.</typeparam> /// <param name="source">The source.</param> /// <param name="executionInterception">The execution interception.</param> /// <returns>INoResultCommandProcessor<TFilter, TResult>.</returns> /// <exception cref="System.ArgumentNullException"></exception> public static IMultipleResultSetCommandProcessor <TFilter> InterceptExceptions <TFilter>( this IMultipleResultSetCommandProcessor <TFilter> source, Action <SusanooExecutionException> executionInterception) { if (executionInterception == null) { throw new ArgumentNullException(nameof(executionInterception)); } return (source.InterceptOrProxyWith( s => new MultipleResultSetExceptionInterceptionProxy <TFilter>(s, executionInterception))); }
/// <summary> /// Initializes a new instance of the <see cref="MultipleResultSetProxy{TFilter}" /> class. /// </summary> /// <param name="source">The source.</param> protected MultipleResultSetProxy(IMultipleResultSetCommandProcessor <TFilter> source) { Source = source; }
/// <summary> /// Initializes a new instance of the <see cref="MultipleResultSetTransformProxy{TFilter}"/> class. /// </summary> /// <param name="source">The source.</param> /// <param name="transforms">The transforms.</param> public MultipleResultSetTransformProxy(IMultipleResultSetCommandProcessor <TFilter> source, IEnumerable <CommandTransform> transforms) : base(source) { _transforms = transforms; }
/// <summary> /// Initializes a new instance of the <see cref="MultipleResultSetExceptionInterceptionProxy{TFilter}" /> class. /// </summary> /// <param name="source">The source.</param> /// <param name="exceptionHandler">The exception handler.</param> public MultipleResultSetExceptionInterceptionProxy(IMultipleResultSetCommandProcessor <TFilter> source, Action <SusanooExecutionException> exceptionHandler) : base(source) { _exceptionHandler = exceptionHandler; }