2
2
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3
3
4
4
using System ;
5
- using System . Collections . Generic ;
6
5
using System . Text . Encodings . Web ;
7
6
using System . Threading . Tasks ;
8
7
using Benchmarks . Configuration ;
9
8
using Benchmarks . Data ;
9
+ using Benchmarks . Templates ;
10
10
using Microsoft . AspNetCore . Builder ;
11
11
using Microsoft . AspNetCore . Http ;
12
12
using Microsoft . Extensions . DependencyInjection ;
13
- using RazorSlices ;
14
13
15
14
namespace Benchmarks . Middleware
16
15
{
@@ -20,13 +19,11 @@ public class FortunesDapperMiddleware
20
19
21
20
private readonly RequestDelegate _next ;
22
21
private readonly HtmlEncoder _htmlEncoder ;
23
- private readonly SliceFactory < IEnumerable < FortuneUtf16 > > _fortunesFactory ;
24
22
25
23
public FortunesDapperMiddleware ( RequestDelegate next , HtmlEncoder htmlEncoder )
26
24
{
27
25
_next = next ;
28
26
_htmlEncoder = htmlEncoder ;
29
- _fortunesFactory = RazorSlice . ResolveSliceFactory < IEnumerable < FortuneUtf16 > > ( "/Templates/FortunesUtf16.cshtml" ) ;
30
27
}
31
28
32
29
public async Task Invoke ( HttpContext httpContext )
@@ -35,8 +32,9 @@ public async Task Invoke(HttpContext httpContext)
35
32
{
36
33
var db = httpContext . RequestServices . GetService < DapperDb > ( ) ;
37
34
var rows = await db . LoadFortunesRows ( ) ;
35
+
38
36
39
- await MiddlewareHelpers . RenderFortunesHtml ( rows , httpContext , _htmlEncoder , _fortunesFactory ) ;
37
+ await MiddlewareHelpers . RenderFortunesHtml ( rows , httpContext , _htmlEncoder , FortunesUtf16 . Create ) ;
40
38
41
39
return ;
42
40
}
0 commit comments