Skip to content

Commit a10a3f6

Browse files
wiworowagalvesribeiro
authored andcommitted
Update the Project To Use the new Libraries in .NET Core 3.0 Preview 7 (#43)
* Update the Project To Use the new Libraries in .NET Core 3.0 Preview 7 * Fix Warnini related with naming conventions * Revert "Fix Warnini related with naming conventions" This reverts commit a580678. * Correct Warning related with naming conventions * Update the yml file to intall the preview7 * Update o te correct version SDK 3.0.100-preview7-012821 * Point Global.Json to the corect version of Preview7 and Update HubConnectionManager to use the new library @microsoft/signalr * Set up CI with Azure Pipelines2 [skip ci] * Revert "Set up CI with Azure Pipelines2" This reverts commit 54a2e3d.
1 parent df584ca commit a10a3f6

File tree

11 files changed

+1793
-1188
lines changed

11 files changed

+1793
-1188
lines changed

.vsts-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ steps:
88
- task: DotNetCoreInstaller@0
99
inputs:
1010
packageType: 'sdk'
11-
version: '3.0.100-preview6-012264'
11+
version: '3.0.100-preview7-012821'
1212

1313
- task: DotNetCoreCLI@2
1414
inputs:

.vsts-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ steps:
88
- task: DotNetCoreInstaller@0
99
inputs:
1010
packageType: 'sdk'
11-
version: '3.0.100-preview6-012264'
11+
version: '3.0.0-preview7.19365.7'
1212

1313
- task: DotNetCoreCLI@2
1414
inputs:

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"sdk": {
3-
"version": "3.0.100-preview6-012264"
3+
"version": "3.0.100-preview7-012821"
44
}
55
}

src/Blazor.Extensions.SignalR.JS/package-lock.json

Lines changed: 1734 additions & 1130 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Blazor.Extensions.SignalR.JS/package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
"test": "echo \"Error: no test specified\" && exit 1"
99
},
1010
"devDependencies": {
11-
"@types/emscripten": "0.0.31",
12-
"ts-loader": "^4.4.2",
13-
"typescript": "^2.9.2",
14-
"webpack": "^4.16.3",
15-
"webpack-cli": "^3.1.0"
11+
"@types/emscripten": "0.0.34",
12+
"ts-loader": "6.0.4",
13+
"typescript": "3.5.3",
14+
"webpack": "4.37.0",
15+
"webpack-cli": "3.3.6"
1616
},
1717
"dependencies": {
18-
"@aspnet/signalr": "^1.0.4",
19-
"@aspnet/signalr-protocol-msgpack": "^1.0.4"
18+
"@microsoft/signalr": "3.0.0-preview7.19365.7",
19+
"@microsoft/signalr-protocol-msgpack": "3.0.0-preview7.19365.7"
2020
}
2121
}

src/Blazor.Extensions.SignalR.JS/src/HubConnectionManager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import * as signalR from "@aspnet/signalr";
2-
import * as sianglRMessagePack from "@aspnet/signalr-protocol-msgpack";
3-
import { HttpTransportType, LogLevel } from "@aspnet/signalr";
1+
import * as signalR from "@microsoft/signalr";
2+
import * as sianglRMessagePack from "@microsoft/signalr-protocol-msgpack";
3+
import { HttpTransportType, LogLevel } from "@microsoft/signalr";
44

55
type DotNetType = {
66
invokeMethod<T>(assemblyName: string, methodIdentifier: string, ...args: any[]): T,

src/Blazor.Extensions.SignalR/Blazor.Extensions.SignalR.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</PropertyGroup>
1616

1717
<ItemGroup>
18-
<PackageReference Include="Microsoft.AspNetCore.Components.Browser" Version="3.0.0-preview6.19307.2" />
18+
<PackageReference Include="Microsoft.AspNetCore.Components.Browser" Version="3.0.0-preview7.19365.7" />
1919
</ItemGroup>
2020

2121
<ItemGroup>

src/Blazor.Extensions.SignalR/HubConnection.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Microsoft.JSInterop;
22
using System;
33
using System.Collections.Generic;
4+
using System.Text.Json;
45
using System.Text.Json.Serialization;
56
using System.Threading.Tasks;
67

@@ -104,43 +105,43 @@ public IDisposable On<TResult1, TResult2, TResult3, TResult4, TResult5, TResult6
104105

105106
if (payloads.Length > 0)
106107
{
107-
t1 = JsonSerializer.Parse<TResult1>(payloads[0]);
108+
t1 = JsonSerializer.Deserialize<TResult1>(payloads[0]);
108109
}
109110
if (payloads.Length > 1)
110111
{
111-
t2 = JsonSerializer.Parse<TResult2>(payloads[1]);
112+
t2 = JsonSerializer.Deserialize<TResult2>(payloads[1]);
112113
}
113114
if (payloads.Length > 2)
114115
{
115-
t3 = JsonSerializer.Parse<TResult3>(payloads[2]);
116+
t3 = JsonSerializer.Deserialize<TResult3>(payloads[2]);
116117
}
117118
if (payloads.Length > 3)
118119
{
119-
t4 = JsonSerializer.Parse<TResult4>(payloads[3]);
120+
t4 = JsonSerializer.Deserialize<TResult4>(payloads[3]);
120121
}
121122
if (payloads.Length > 4)
122123
{
123-
t5 = JsonSerializer.Parse<TResult5>(payloads[4]);
124+
t5 = JsonSerializer.Deserialize<TResult5>(payloads[4]);
124125
}
125126
if (payloads.Length > 5)
126127
{
127-
t6 = JsonSerializer.Parse<TResult6>(payloads[5]);
128+
t6 = JsonSerializer.Deserialize<TResult6>(payloads[5]);
128129
}
129130
if (payloads.Length > 6)
130131
{
131-
t7 = JsonSerializer.Parse<TResult7>(payloads[6]);
132+
t7 = JsonSerializer.Deserialize<TResult7>(payloads[6]);
132133
}
133134
if (payloads.Length > 7)
134135
{
135-
t8 = JsonSerializer.Parse<TResult8>(payloads[7]);
136+
t8 = JsonSerializer.Deserialize<TResult8>(payloads[7]);
136137
}
137138
if (payloads.Length > 8)
138139
{
139-
t9 = JsonSerializer.Parse<TResult9>(payloads[8]);
140+
t9 = JsonSerializer.Deserialize<TResult9>(payloads[8]);
140141
}
141142
if (payloads.Length > 9)
142143
{
143-
t10 = JsonSerializer.Parse<TResult10>(payloads[9]);
144+
t10 = JsonSerializer.Deserialize<TResult10>(payloads[9]);
144145
}
145146

146147
return handler(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10);

test/Blazor.Extensions.SignalR.Test.Client/Blazor.Extensions.SignalR.Test.Client.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
<RazorLangVersion>3.0</RazorLangVersion>
1111
</PropertyGroup>
1212
<ItemGroup>
13-
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview6.19307.2" />
14-
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.0.0-preview6.19307.2" PrivateAssets="all" />
13+
<PackageReference Include="Microsoft.AspNetCore.Blazor" Version="3.0.0-preview7.19365.7" />
14+
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="3.0.0-preview7.19365.7" PrivateAssets="all" />
1515
</ItemGroup>
1616

1717
<ItemGroup>

test/Blazor.Extensions.SignalR.Test.Client/Pages/ChatComponent.cs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ public class ChatComponent : ComponentBase
2323

2424
private IDisposable objectHandle;
2525
private IDisposable listHandle;
26-
private IDisposable _multiArgsHandle;
27-
private IDisposable _multiArgsComplexHandle;
28-
private IDisposable _byteArrayHandle;
29-
private HubConnection _connection;
26+
private IDisposable multiArgsHandle;
27+
private IDisposable multiArgsComplexHandle;
28+
private IDisposable byteArrayHandle;
29+
private HubConnection connection;
3030

3131
protected override async Task OnInitAsync()
3232
{
33-
this._connection = this._hubConnectionBuilder
33+
this.connection = this._hubConnectionBuilder
3434
.WithUrl("/chathub",
3535
opt =>
3636
{
@@ -47,13 +47,13 @@ protected override async Task OnInitAsync()
4747
//.AddMessagePackProtocol()
4848
.Build();
4949

50-
this._connection.On<string>("Send", this.Handle);
51-
this._connection.OnClose(exc =>
50+
this.connection.On<string>("Send", this.Handle);
51+
this.connection.OnClose(exc =>
5252
{
5353
Console.WriteLine("Connection was closed! " + exc.ToString());
5454
return Task.CompletedTask;
5555
});
56-
await this._connection.StartAsync();
56+
await this.connection.StartAsync();
5757
}
5858

5959
public Task DemoMethodObject(object data)
@@ -77,23 +77,23 @@ public Task DemoMethodList(object data)
7777
public Task DemoMultipleArgs(string arg1, int arg2, string arg3, int arg4)
7878
{
7979
Console.WriteLine("Got Multiple Args!");
80-
this._multiArgsHandle.Dispose();
80+
this.multiArgsHandle.Dispose();
8181

8282
return this.HandleArgs(arg1, arg2, arg3, arg4);
8383
}
8484

8585
public Task DemoMultipleArgsComplex(object arg1, object arg2)
8686
{
8787
Console.WriteLine("Got Multiple Args Complex!");
88-
this._multiArgsComplexHandle.Dispose();
88+
this.multiArgsComplexHandle.Dispose();
8989

9090
return this.HandleArgs(arg1, arg2);
9191
}
9292

9393
public Task DemoByteArrayArg(byte[] array)
9494
{
9595
Console.WriteLine("Got byte array!");
96-
this._byteArrayHandle.Dispose();
96+
this.byteArrayHandle.Dispose();
9797

9898
return this.HandleArgs(BitConverter.ToString(array));
9999
}
@@ -125,65 +125,65 @@ private Task HandleArgs(params object[] args)
125125

126126
internal async Task Broadcast()
127127
{
128-
await this._connection.InvokeAsync("Send", this.ToEverybody);
128+
await this.connection.InvokeAsync("Send", this.ToEverybody);
129129
}
130130

131131
internal async Task SendToOthers()
132132
{
133-
await this._connection.InvokeAsync("SendToOthers", this.ToEverybody);
133+
await this.connection.InvokeAsync("SendToOthers", this.ToEverybody);
134134
}
135135

136136
internal async Task SendToConnection()
137137
{
138-
await this._connection.InvokeAsync("SendToConnection", this.ConnectionId, this.ToConnection);
138+
await this.connection.InvokeAsync("SendToConnection", this.ConnectionId, this.ToConnection);
139139
}
140140

141141
internal async Task SendToMe()
142142
{
143-
await this._connection.InvokeAsync("Echo", this.ToMe);
143+
await this.connection.InvokeAsync("Echo", this.ToMe);
144144
}
145145

146146
internal async Task SendToGroup()
147147
{
148-
await this._connection.InvokeAsync("SendToGroup", this.GroupName, this.ToGroup);
148+
await this.connection.InvokeAsync("SendToGroup", this.GroupName, this.ToGroup);
149149
}
150150

151151
internal async Task SendToOthersInGroup()
152152
{
153-
await this._connection.InvokeAsync("SendToOthersInGroup", this.GroupName, this.ToGroup);
153+
await this.connection.InvokeAsync("SendToOthersInGroup", this.GroupName, this.ToGroup);
154154
}
155155

156156
internal async Task JoinGroup()
157157
{
158-
await this._connection.InvokeAsync("JoinGroup", this.GroupName);
158+
await this.connection.InvokeAsync("JoinGroup", this.GroupName);
159159
}
160160

161161
internal async Task LeaveGroup()
162162
{
163-
await this._connection.InvokeAsync("LeaveGroup", this.GroupName);
163+
await this.connection.InvokeAsync("LeaveGroup", this.GroupName);
164164
}
165165

166166
internal async Task DoMultipleArgs()
167167
{
168-
this._multiArgsHandle = this._connection.On<string, int, string, int>("DemoMultiArgs", this.DemoMultipleArgs);
169-
this._multiArgsComplexHandle = this._connection.On<DemoData, DemoData[]>("DemoMultiArgs2", this.DemoMultipleArgsComplex);
170-
await this._connection.InvokeAsync("DoMultipleArgs");
171-
await this._connection.InvokeAsync("DoMultipleArgsComplex");
168+
this.multiArgsHandle = this.connection.On<string, int, string, int>("DemoMultiArgs", this.DemoMultipleArgs);
169+
this.multiArgsComplexHandle = this.connection.On<DemoData, DemoData[]>("DemoMultiArgs2", this.DemoMultipleArgsComplex);
170+
await this.connection.InvokeAsync("DoMultipleArgs");
171+
await this.connection.InvokeAsync("DoMultipleArgsComplex");
172172
}
173173

174174
internal async Task DoByteArrayArg()
175175
{
176-
this._byteArrayHandle = this._connection.On<byte[]>("DemoByteArrayArg", this.DemoByteArrayArg);
177-
var array = await this._connection.InvokeAsync<byte[]>("DoByteArrayArg");
176+
this.byteArrayHandle = this.connection.On<byte[]>("DemoByteArrayArg", this.DemoByteArrayArg);
177+
var array = await this.connection.InvokeAsync<byte[]>("DoByteArrayArg");
178178

179179
Console.WriteLine("Got byte returned from hub method array: {0}", BitConverter.ToString(array));
180180
}
181181

182182
internal async Task TellHubToDoStuff()
183183
{
184-
this.objectHandle = this._connection.On<DemoData>("DemoMethodObject", this.DemoMethodObject);
185-
this.listHandle = this._connection.On<DemoData[]>("DemoMethodList", this.DemoMethodList);
186-
await this._connection.InvokeAsync("DoSomething");
184+
this.objectHandle = this.connection.On<DemoData>("DemoMethodObject", this.DemoMethodObject);
185+
this.listHandle = this.connection.On<DemoData[]>("DemoMethodList", this.DemoMethodList);
186+
await this.connection.InvokeAsync("DoSomething");
187187
}
188188
}
189189
}

0 commit comments

Comments
 (0)