public async Task Invoke(HttpContext context)
        {
            PathString batchCallPath;

            //to do patternize it using StringPath from config
            if (context.Request.Path.StartsWithSegments(new PathString("/batch"), out batchCallPath))
            {
                try
                {
                    await _batchHandler.InvokeAsync(context);
                }catch (BatchNotFoundException ex)
                {
                    _logger.LogError(ex, ex.Message);
                    context.Response.StatusCode = StatusCodes.Status404NotFound;
                }
            }
            else if (_next != null)
            {
                await _next.Invoke(context);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Start nested batch action.
        /// </summary>
        /// <param name="batchName">Batch name</param>
        /// <param name="actionName">Action name</param>
        /// <param name="context">The <see cref="ContextInvoker"/> context</param>
        /// <returns>Return a <see cref="Task"/></returns>
        public Task startBatch(string batchName, string actionName, ContextInvoker context)
        {
            BatchUrlManager urlManager = new BatchUrlManager(batchName, actionName);

            return(_batchHandler.InvokeAsync(context, urlManager));
        }