Esempio n. 1
0
        public Task Invoke(HttpContext httpContext)
        {
            if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
            {
                var db   = httpContext.RequestServices.GetService <RawDb>();
                var rows = db.LoadFortunesRowsSync();

                return(MiddlewareHelpers.RenderFortunesHtml(rows, httpContext, _htmlEncoder));
            }

            return(_next(httpContext));
        }
Esempio n. 2
0
        public async Task Invoke(HttpContext httpContext)
        {
            if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
            {
                var rows = await _db.LoadFortunesRows();

                await MiddlewareHelpers.RenderFortunesHtml(rows, httpContext, _htmlEncoder);

                return;
            }

            await _next(httpContext);
        }
Esempio n. 3
0
        public async Task Invoke(HttpContext httpContext)
        {
            if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
            {
                var db   = httpContext.RequestServices.GetService <RawDb>();
                var rows = await db.LoadFortunesRows();

                await MiddlewareHelpers.RenderFortunesHtml(rows, httpContext, _htmlEncoder);
            }
            else
            {
                await _next(httpContext);
            }
        }