File tree Expand file tree Collapse file tree 6 files changed +27
-13
lines changed Expand file tree Collapse file tree 6 files changed +27
-13
lines changed Original file line number Diff line number Diff line change
1
+ <Router AppAssembly =" @typeof(App).Assembly" >
2
+ <Found Context =" routeData" >
3
+ <RouteView RouteData =" @routeData" />
4
+ </Found >
5
+ <NotFound >
6
+ not found
7
+ </NotFound >
8
+ </Router >
Original file line number Diff line number Diff line change 1
- @inject Db Db
1
+ @page " /fortunes"
2
+ @inject Db Db
2
3
<!DOCTYPE html>
3
4
<html >
4
5
<head >
Original file line number Diff line number Diff line change 1
- @using Microsoft .EntityFrameworkCore ;
1
+ @page " /fortunes-ef"
2
+ @using Microsoft .EntityFrameworkCore ;
2
3
@inject Db Db
3
4
@inject AppDbContext DbContext
4
5
<!DOCTYPE html>
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
28
29
var settings = new TextEncoderSettings ( UnicodeRanges . BasicLatin , UnicodeRanges . Katakana , UnicodeRanges . Hiragana ) ;
29
30
settings . AllowCharacter ( '\u2014 ' ) ; // allow EM DASH through
30
31
return HtmlEncoder . Create ( settings ) ;
31
32
} ) ;
32
33
33
34
var app = builder . Build ( ) ;
34
35
35
- app . MapGet ( "/fortunes" , ( ) => new RazorComponentResult < Fortunes > ( ) ) ;
36
- app . MapGet ( "/fortunes-ef" , ( ) => new RazorComponentResult < FortunesEf > ( ) ) ;
36
+ app . MapRazorComponents < App > ( ) ;
37
+
38
+ app . MapGet ( "/direct/fortunes" , ( ) => new RazorComponentResult < Fortunes > ( ) ) ;
39
+ app . MapGet ( "/direct/fortunes-ef" , ( ) => new RazorComponentResult < FortunesEf > ( ) ) ;
37
40
38
41
app . Lifetime . ApplicationStarted . Register ( ( ) => Console . WriteLine ( "Application started. Press Ctrl+C to shut down." ) ) ;
39
42
app . Lifetime . ApplicationStopping . Register ( ( ) => Console . WriteLine ( "Application is shutting down..." ) ) ;
40
43
41
44
app . Run ( ) ;
42
-
43
- // TODO: Use this custom configured HtmlEncoder when Blazor supports it: https://github.com/dotnet/aspnetcore/issues/47477
44
- //static HtmlEncoder CreateHtmlEncoder()
45
- //{
46
- // var settings = new TextEncoderSettings(UnicodeRanges.BasicLatin, UnicodeRanges.Katakana, UnicodeRanges.Hiragana);
47
- // settings.AllowCharacter('\u2014'); // allow EM DASH through
48
- // return HtmlEncoder.Create(settings);
49
- //}
Original file line number Diff line number Diff line change 4
4
"http" : {
5
5
"commandName" : " Project" ,
6
6
"launchBrowser" : true ,
7
+ "launchUrl" : " fortunes" ,
7
8
"environmentVariables" : {
8
9
"ASPNETCORE_ENVIRONMENT" : " Development"
9
10
},
Original file line number Diff line number Diff line change 1
- @using BlazorSSR .Database
1
+ @using System .Net .Http
2
+ @using System .Net .Http .Json
3
+ @using Microsoft .AspNetCore .Components .Forms
4
+ @using Microsoft .AspNetCore .Components .Routing
5
+ @using Microsoft .AspNetCore .Components .Web
6
+ @using Microsoft .AspNetCore .Components .Web .Virtualization
7
+ @using Microsoft .JSInterop
8
+ @using BlazorSSR
9
+ @using BlazorSSR .Database
2
10
@using BlazorSSR .Models
You can’t perform that action at this time.
0 commit comments