File tree Expand file tree Collapse file tree 2 files changed +2
-4
lines changed
src/BenchmarksApps/TechEmpower Expand file tree Collapse file tree 2 files changed +2
-4
lines changed Original file line number Diff line number Diff line change 25
25
builder . Services . AddRazorComponents ( ) ;
26
26
builder . Services . AddSingleton ( serviceProvider =>
27
27
{
28
- // TODO: This custom configured HtmlEncoder won't actually be used until Blazor supports it: https://github.com/dotnet/aspnetcore/issues/47477
29
28
var settings = new TextEncoderSettings ( UnicodeRanges . BasicLatin , UnicodeRanges . Katakana , UnicodeRanges . Hiragana ) ;
30
29
settings . AllowCharacter ( '\u2014 ' ) ; // allow EM DASH through
31
30
return HtmlEncoder . Create ( settings ) ;
Original file line number Diff line number Diff line change 23
23
// Add services to the container.
24
24
builder . Services . AddSingleton ( new Db ( appSettings ) ) ;
25
25
builder . Services . AddRazorComponents ( ) ;
26
+ builder . Services . AddSingleton ( CreateHtmlEncoder ( ) ) ;
26
27
27
28
var app = builder . Build ( ) ;
28
29
38
39
39
40
app . MapGet ( "/db/result" , async ( Db db ) => Results . Json ( await db . LoadSingleQueryRow ( ) ) ) ;
40
41
41
- var htmlEncoder = CreateHtmlEncoder ( ) ;
42
-
43
- app . MapGet ( "/fortunes" , async ( HttpContext context , Db db ) => {
42
+ app . MapGet ( "/fortunes" , async ( HttpContext context , Db db , HtmlEncoder htmlEncoder ) => {
44
43
var fortunes = await db . LoadFortunesRows ( ) ;
45
44
//var fortunes = await db.LoadFortunesRowsNoDb(); // Don't call the database
46
45
var template = ( RazorSliceHttpResult < List < Fortune > > ) Fortunes . Create ( fortunes ) ;
You can’t perform that action at this time.
0 commit comments