Skip to content

Commit 2db930a

Browse files
committed
Upgrade to preview 6
1 parent 924203d commit 2db930a

10 files changed

Lines changed: 41 additions & 32 deletions

File tree

‎samples/BlazorClientSide/App.razor‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
Configuring this here is temporary. Later we'll move the app config
33
into Program.cs, and it won't be necessary to specify AppAssembly.
44
-->
5-
<Router AppAssembly=typeof(Program).Assembly />
5+
<Router AppAssembly=typeof(Program).Assembly>
6+
<NotFoundContent>
7+
Route Not Found.
8+
</NotFoundContent>
9+
</Router>

‎samples/BlazorClientSide/BlazorClientSide.csproj‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview4-19216-03" />
15-
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.0.0-preview4-19216-03" PrivateAssets="all" />
16-
<PackageReference Include="Microsoft.AspNetCore.Blazor.DevServer" Version="3.0.0-preview4-19216-03" PrivateAssets="all" />
14+
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview6.19307.2" />
15+
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.0.0-preview6.19307.2" PrivateAssets="all" />
16+
<PackageReference Include="Microsoft.AspNetCore.Blazor.DevServer" Version="3.0.0-preview6.19307.2" PrivateAssets="all" />
1717
</ItemGroup>
1818

1919
<ItemGroup>

‎samples/BlazorClientSide/Pages/Index.razor‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ Welcome to your new app.
1414
<div class="col-md-4">
1515
<h5>Add Item to session storage</h5>
1616
<div class="input-group">
17-
<input class="form-control" type="text" placeholder="Enter a value" bind="@Name" />
17+
<input class="form-control" type="text" placeholder="Enter a value" @bind="@Name" />
1818
<div class="input-group-append">
19-
<button class="btn btn-primary" onclick="@SaveName">Save</button>
19+
<button class="btn btn-primary" @onclick="@SaveName">Save</button>
2020
</div>
2121
</div>
2222
</div>
2323

2424
<div class="col-md-4">
2525
<h5>Remove item from session storage</h5>
26-
<button class="btn btn-primary" onclick=@RemoveName>Remove Item</button>
26+
<button class="btn btn-primary" @onclick=@RemoveName>Remove Item</button>
2727
</div>
2828

2929
<div class="col-md-4">
3030
<h5>Clear session storage</h5>
31-
<button class="btn btn-primary" onclick=@ClearSessionStorage>Clear All</button>
31+
<button class="btn btn-primary" @onclick=@ClearSessionStorage>Clear All</button>
3232
</div>
3333
</div>
3434

@@ -45,7 +45,7 @@ Welcome to your new app.
4545
</div>
4646
</div>
4747

48-
@functions {
48+
@code {
4949

5050
string NameFromSessionStorage { get; set; }
5151
int ItemsInSessionStorage { get; set; }

‎samples/BlazorClientSide/Pages/Sync.razor‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010
<div class="input-group">
1111
<input class="form-control" type="text" placeholder="Enter a value" bind="@Name" />
1212
<div class="input-group-append">
13-
<button class="btn btn-primary" onclick="@SaveName">Save</button>
13+
<button class="btn btn-primary" @onclick="@SaveName">Save</button>
1414
</div>
1515
</div>
1616
</div>
1717

1818
<div class="col-md-4">
1919
<h5>Remove item from session storage</h5>
20-
<button class="btn btn-primary" onclick=@RemoveName>Remove Item</button>
20+
<button class="btn btn-primary" @onclick=@RemoveName>Remove Item</button>
2121
</div>
2222

2323
<div class="col-md-4">
2424
<h5>Clear session storage</h5>
25-
<button class="btn btn-primary" onclick=@ClearSessionStorage>Clear All</button>
25+
<button class="btn btn-primary" @onclick=@ClearSessionStorage>Clear All</button>
2626
</div>
2727
</div>
2828

@@ -39,7 +39,7 @@
3939
</div>
4040
</div>
4141

42-
@functions {
42+
@code {
4343

4444
string NameFromSessionStorage { get; set; }
4545
int ItemsInSessionStorage { get; set; }

‎samples/BlazorClientSide/Shared/NavMenu.razor‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<div class="top-row pl-4 navbar navbar-dark">
22
<a class="navbar-brand" href="">Blazored SessionStorage</a>
3-
<button class="navbar-toggler" onclick=@ToggleNavMenu>
3+
<button class="navbar-toggler" @onclick=@ToggleNavMenu>
44
<span class="navbar-toggler-icon"></span>
55
</button>
66
</div>
77

8-
<div class=@(collapseNavMenu ? "collapse" : null) onclick=@ToggleNavMenu>
8+
<div class=@(collapseNavMenu ? "collapse" : null) @onclick=@ToggleNavMenu>
99
<ul class="nav flex-column">
1010
<li class="nav-item px-3">
1111
<NavLink class="nav-link" href="" Match=NavLinkMatch.All>
@@ -18,7 +18,7 @@
1818
</ul>
1919
</div>
2020

21-
@functions {
21+
@code {
2222
bool collapseNavMenu = true;
2323

2424
void ToggleNavMenu()

‎samples/BlazorServerSide/App.razor‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
The Router component displays whichever component has a @page
33
directive matching the current URI.
44
*@
5-
<Router AppAssembly="typeof(Startup).Assembly" />
5+
<Router AppAssembly="typeof(Startup).Assembly">
6+
<NotFoundContent>
7+
Route Not Found.
8+
</NotFoundContent>
9+
</Router>

‎samples/BlazorServerSide/Pages/Index.razor‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ Welcome to your new app.
1414
<div class="col-md-4">
1515
<h5>Add Item to session storage</h5>
1616
<div class="input-group">
17-
<input class="form-control" type="text" placeholder="Enter a value" bind="@Name" />
17+
<input class="form-control" type="text" placeholder="Enter a value" @bind="@Name" />
1818
<div class="input-group-append">
19-
<button class="btn btn-primary" onclick="@SaveName">Save</button>
19+
<button class="btn btn-primary" @onclick="@SaveName">Save</button>
2020
</div>
2121
</div>
2222
</div>
2323

2424
<div class="col-md-4">
2525
<h5>Remove item from session storage</h5>
26-
<button class="btn btn-primary" onclick=@RemoveName>Remove Item</button>
26+
<button class="btn btn-primary" @onclick=@RemoveName>Remove Item</button>
2727
</div>
2828

2929
<div class="col-md-4">
3030
<h5>Clear session storage</h5>
31-
<button class="btn btn-primary" onclick=@ClearSessionStorage>Clear All</button>
31+
<button class="btn btn-primary" @onclick=@ClearSessionStorage>Clear All</button>
3232
</div>
3333
</div>
3434

@@ -45,7 +45,7 @@ Welcome to your new app.
4545
</div>
4646
</div>
4747

48-
@functions {
48+
@code {
4949

5050
string NameFromSessionStorage { get; set; }
5151
int ItemsInSessionStorage { get; set; }

‎samples/BlazorServerSide/Shared/NavMenu.razor‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<div class="top-row pl-4 navbar navbar-dark">
22
<a class="navbar-brand" href="">Blazored SessionStorage</a>
3-
<button class="navbar-toggler" onclick="@ToggleNavMenu">
3+
<button class="navbar-toggler" @onclick="@ToggleNavMenu">
44
<span class="navbar-toggler-icon"></span>
55
</button>
66
</div>
77

8-
<div class="@NavMenuCssClass" onclick="@ToggleNavMenu">
8+
<div class="@NavMenuCssClass" @onclick="@ToggleNavMenu">
99
<ul class="nav flex-column">
1010
<li class="nav-item px-3">
1111
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
@@ -15,7 +15,7 @@
1515
</ul>
1616
</div>
1717

18-
@functions {
18+
@code {
1919
bool collapseNavMenu = true;
2020

2121
string NavMenuCssClass => collapseNavMenu ? "collapse" : null;

‎src/Blazored.SessionStorage/Blazored.SessionStorage.csproj‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<TypeScriptToolsVersion>3.2</TypeScriptToolsVersion>
1010

1111
<PackageId>Blazored.SessionStorage</PackageId>
12-
<Version>1.0.1</Version>
12+
<Version>1.0.2</Version>
1313
<Authors>Chris Sainty</Authors>
1414
<Description>A library to provide access to session storage in Blazor applications</Description>
1515
<Copyright>Copyright 2018 (c) Chris Sainty. All rights reserved.</Copyright>
@@ -29,8 +29,8 @@
2929
</ItemGroup>
3030

3131
<ItemGroup>
32-
<PackageReference Include="Microsoft.AspNetCore.Components.Browser" Version="3.0.0-preview4-19216-03" />
33-
<PackageReference Include="Microsoft.TypeScript.MsBuild" Version="3.4.3">
32+
<PackageReference Include="Microsoft.AspNetCore.Components.Browser" Version="3.0.0-preview6.19307.2" />
33+
<PackageReference Include="Microsoft.TypeScript.MsBuild" Version="3.5.2">
3434
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3535
<PrivateAssets>all</PrivateAssets>
3636
</PackageReference>

‎src/Blazored.SessionStorage/SessionStorageService.cs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Microsoft.JSInterop;
22
using System;
3+
using System.Text.Json.Serialization;
34
using System.Threading.Tasks;
45

56
namespace Blazored.SessionStorage
@@ -25,7 +26,7 @@ public async Task SetItemAsync(string key, object data)
2526
if (e.Cancel)
2627
return;
2728

28-
await _jSRuntime.InvokeAsync<object>("Blazored.SessionStorage.SetItem", key, Json.Serialize(data));
29+
await _jSRuntime.InvokeAsync<object>("Blazored.SessionStorage.SetItem", key, JsonSerializer.ToString(data));
2930

3031
RaiseOnChanged(key, e.OldValue, data);
3132
}
@@ -40,7 +41,7 @@ public async Task<T> GetItemAsync<T>(string key)
4041
if (serialisedData == null)
4142
return default(T);
4243

43-
return Json.Deserialize<T>(serialisedData);
44+
return JsonSerializer.Parse<T>(serialisedData);
4445
}
4546

4647
public async Task RemoveItemAsync(string key)
@@ -70,7 +71,7 @@ public void SetItem(string key, object data)
7071
if (e.Cancel)
7172
return;
7273

73-
_jSInProcessRuntime.Invoke<object>("Blazored.SessionStorage.SetItem", key, Json.Serialize(data));
74+
_jSInProcessRuntime.Invoke<object>("Blazored.SessionStorage.SetItem", key, JsonSerializer.ToString(data));
7475

7576
RaiseOnChanged(key, e.OldValue, data);
7677
}
@@ -88,7 +89,7 @@ public T GetItem<T>(string key)
8889
if (serialisedData == null)
8990
return default(T);
9091

91-
return Json.Deserialize<T>(serialisedData);
92+
return JsonSerializer.Parse<T>(serialisedData);
9293
}
9394

9495
public void RemoveItem(string key)

0 commit comments

Comments
 (0)