Skip to content

Commit fd298dd

Browse files
kant2002galvesribeiro
authored andcommitted
Update to .NET Core 3 Preview 9 (#37)
1 parent 948d84d commit fd298dd

File tree

8 files changed

+41
-33
lines changed

8 files changed

+41
-33
lines changed

.vsts-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ steps:
77
- task: DotNetCoreInstaller@0
88
inputs:
99
packageType: 'sdk'
10-
version: 3.0.100-preview8-013656
10+
version: 3.0.100-preview9-014004
1111

1212
- task: Npm@1
1313
displayName: 'Install NPM dependencies'

src/Blazor.Extensions.Storage/Blazor.Extensions.Storage.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
44
<Title>Blazor Extensions Storage</Title>
@@ -15,7 +15,7 @@
1515
</PropertyGroup>
1616

1717
<ItemGroup>
18-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.0.0-preview8.19405.7" />
18+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.0.0-preview9.19424.4" />
1919
</ItemGroup>
2020

2121
<ItemGroup>

src/Blazor.Extensions.Storage/Interfaces/IStorage.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ namespace Blazor.Extensions.Storage.Interfaces
44
{
55
public interface IStorage
66
{
7-
Task<TItem> GetItem<TItem>(string key);
8-
Task<string> Key(int index);
9-
Task RemoveItem(string key);
10-
Task SetItem<TItem>(string key, TItem item);
11-
Task Clear();
12-
Task<int> Length();
7+
ValueTask<TItem> GetItem<TItem>(string key);
8+
ValueTask<string> Key(int index);
9+
ValueTask RemoveItem(string key);
10+
ValueTask SetItem<TItem>(string key, TItem item);
11+
ValueTask Clear();
12+
ValueTask<int> Length();
1313
}
1414
}

src/Blazor.Extensions.Storage/LocalStorage.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,36 @@ public class LocalStorage : IStorage
99
{
1010
private readonly IJSRuntime runtime;
1111

12-
public Task<int> Length() => this.runtime.InvokeAsync<int>(MethodNames.LENGTH_METHOD, StorageTypeNames.LOCAL_STORAGE);
12+
public ValueTask<int> Length() => this.runtime.InvokeAsync<int>(MethodNames.LENGTH_METHOD, StorageTypeNames.LOCAL_STORAGE);
1313

14-
public Task Clear() => this.runtime.InvokeAsync<object>(MethodNames.CLEAR_METHOD, StorageTypeNames.LOCAL_STORAGE);
14+
public ValueTask Clear() => this.runtime.InvokeVoidAsync(MethodNames.CLEAR_METHOD, StorageTypeNames.LOCAL_STORAGE);
1515

1616
public LocalStorage(IJSRuntime runtime)
1717
{
1818
this.runtime = runtime;
1919
}
2020

21-
public Task<TItem> GetItem<TItem>(string key)
21+
public ValueTask<TItem> GetItem<TItem>(string key)
2222
{
2323
if (string.IsNullOrWhiteSpace(key)) throw new ArgumentNullException(nameof(key));
2424

2525
return this.runtime.InvokeAsync<TItem>(MethodNames.GET_ITEM_METHOD, StorageTypeNames.LOCAL_STORAGE, key);
2626
}
2727

28-
public Task<string> Key(int index) => this.runtime.InvokeAsync<string>(MethodNames.KEY_METHOD, StorageTypeNames.LOCAL_STORAGE, index);
28+
public ValueTask<string> Key(int index) => this.runtime.InvokeAsync<string>(MethodNames.KEY_METHOD, StorageTypeNames.LOCAL_STORAGE, index);
2929

30-
public Task RemoveItem(string key)
30+
public ValueTask RemoveItem(string key)
3131
{
3232
if (string.IsNullOrWhiteSpace(key)) throw new ArgumentNullException(nameof(key));
3333

34-
return this.runtime.InvokeAsync<object>(MethodNames.REMOVE_ITEM_METHOD, StorageTypeNames.LOCAL_STORAGE, key);
34+
return this.runtime.InvokeVoidAsync(MethodNames.REMOVE_ITEM_METHOD, StorageTypeNames.LOCAL_STORAGE, key);
3535
}
3636

37-
public Task SetItem<TItem>(string key, TItem item)
37+
public ValueTask SetItem<TItem>(string key, TItem item)
3838
{
3939
if (string.IsNullOrWhiteSpace(key)) throw new ArgumentNullException(nameof(key));
4040

41-
return this.runtime.InvokeAsync<object>(MethodNames.SET_ITEM_METHOD, StorageTypeNames.LOCAL_STORAGE, key, item);
41+
return this.runtime.InvokeVoidAsync(MethodNames.SET_ITEM_METHOD, StorageTypeNames.LOCAL_STORAGE, key, item);
4242
}
4343
}
4444
}

src/Blazor.Extensions.Storage/SessionStorage.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,36 @@ public class SessionStorage : IStorage
99
{
1010
private readonly IJSRuntime runtime;
1111

12-
public Task<int> Length() => this.runtime.InvokeAsync<int>(MethodNames.LENGTH_METHOD, StorageTypeNames.SESSION_STORAGE);
12+
public ValueTask<int> Length() => this.runtime.InvokeAsync<int>(MethodNames.LENGTH_METHOD, StorageTypeNames.SESSION_STORAGE);
1313

14-
public Task Clear() => this.runtime.InvokeAsync<object>(MethodNames.CLEAR_METHOD, StorageTypeNames.SESSION_STORAGE);
14+
public ValueTask Clear() => this.runtime.InvokeVoidAsync(MethodNames.CLEAR_METHOD, StorageTypeNames.SESSION_STORAGE);
1515

1616
public SessionStorage(IJSRuntime runtime)
1717
{
1818
this.runtime = runtime;
1919
}
2020

21-
public Task<TItem> GetItem<TItem>(string key)
21+
public ValueTask<TItem> GetItem<TItem>(string key)
2222
{
2323
if (string.IsNullOrWhiteSpace(key)) throw new ArgumentNullException(nameof(key));
2424

2525
return this.runtime.InvokeAsync<TItem>(MethodNames.GET_ITEM_METHOD, StorageTypeNames.SESSION_STORAGE, key);
2626
}
2727

28-
public Task<string> Key(int index) => this.runtime.InvokeAsync<string>(MethodNames.KEY_METHOD, StorageTypeNames.SESSION_STORAGE, index);
28+
public ValueTask<string> Key(int index) => this.runtime.InvokeAsync<string>(MethodNames.KEY_METHOD, StorageTypeNames.SESSION_STORAGE, index);
2929

30-
public Task RemoveItem(string key)
30+
public ValueTask RemoveItem(string key)
3131
{
3232
if (string.IsNullOrWhiteSpace(key)) throw new ArgumentNullException(nameof(key));
3333

34-
return this.runtime.InvokeAsync<object>(MethodNames.REMOVE_ITEM_METHOD, StorageTypeNames.SESSION_STORAGE, key);
34+
return this.runtime.InvokeVoidAsync(MethodNames.REMOVE_ITEM_METHOD, StorageTypeNames.SESSION_STORAGE, key);
3535
}
3636

37-
public Task SetItem<TItem>(string key, TItem item)
37+
public ValueTask SetItem<TItem>(string key, TItem item)
3838
{
3939
if (string.IsNullOrWhiteSpace(key)) throw new ArgumentNullException(nameof(key));
4040

41-
return this.runtime.InvokeAsync<TItem>(MethodNames.SET_ITEM_METHOD, StorageTypeNames.SESSION_STORAGE, key, item);
41+
return this.runtime.InvokeVoidAsync(MethodNames.SET_ITEM_METHOD, StorageTypeNames.SESSION_STORAGE, key, item);
4242
}
4343
}
4444
}
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
<!--
1+
<!--
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+
<Found Context="routeData">
7+
<RouteView RouteData="routeData" DefaultLayout="typeof(MainLayout)" />
8+
</Found>
9+
<NotFound>
10+
<h1>Page not found</h1>
11+
<p>Sorry, but there's nothing here!</p>
12+
</NotFound>
13+
</Router>

test/Blazor.Extensions.Storage.Test/Blazor.Extensions.Storage.Test.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview8.19405.7" />
11-
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.0.0-preview8.19405.7" PrivateAssets="all" />
12-
<PackageReference Include="Microsoft.AspNetCore.Blazor.DevServer" Version="3.0.0-preview8.19405.7" PrivateAssets="all" />
13-
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.0.0-preview8.19405.7" />
10+
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview9.19424.4" />
11+
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.0.0-preview9.19424.4" PrivateAssets="all" />
12+
<PackageReference Include="Microsoft.AspNetCore.Blazor.DevServer" Version="3.0.0-preview9.19424.4" PrivateAssets="all" />
13+
<PackageReference Include="Microsoft.AspNetCore.Blazor.HttpClient" Version="3.0.0-preview9.19424.4" />
1414
</ItemGroup>
1515

1616
<ItemGroup>

test/Blazor.Extensions.Storage.Test/Interop/InteropStorage.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public InteropStorage(IJSRuntime runtime)
2020
/// </summary>
2121
/// <param name="key">Key associated with stroed value.</param>
2222
/// <returns>Task that returns the stored value as a string.</returns>
23-
public async Task<string> GetSessionStorage(string key)
23+
public async ValueTask<string> GetSessionStorage(string key)
2424
{
2525
return await this.runtime.InvokeAsync<string>(
2626
"getSessionStorage",
@@ -33,7 +33,7 @@ public async Task<string> GetSessionStorage(string key)
3333
/// </summary>
3434
/// <param name="key">Key associated with stroed value.</param>
3535
/// <returns>Task that returns the stored value as a string.</returns>
36-
public async Task<string> GetLocalStorage(string key)
36+
public async ValueTask<string> GetLocalStorage(string key)
3737
{
3838
return await this.runtime.InvokeAsync<string>(
3939
"getLocalStorage",

0 commit comments

Comments
 (0)