diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2da9a99..5996705 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,9 +13,13 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Install .NET SDK - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v2 with: - dotnet-version: '6.x' + dotnet-version: | + 6.0.x + 7.0.x + 8.0.x + include-prerelease: true - name: Build run: dotnet build --configuration Release - name: Test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 590c1b5..46de108 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,9 +11,13 @@ jobs: with: fetch-depth: 0 - name: Install .NET SDK - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v2 with: - dotnet-version: '6.x' + dotnet-version: | + 6.0.x + 7.0.x + 8.0.x + include-prerelease: true - name: Set VERSION run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV - name: Build diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..846484f --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,16 @@ + + + net6.0;net7.0;net8.0 + 11.0 + IntelliTect + enable + enable + + https://github.com/IntelliTect/IntelliTect.AspNetCore.SignalR.SqlServer + git + IntelliTect-Nuget + Apache-2.0 + A Microsoft SQL Server backplane for ASP.NET Core SignalR. + IntelliTect aspnetcore sqlserver signalr + + \ No newline at end of file diff --git a/IntelliTect.AspNetCore.SignalR.SqlServer.sln b/IntelliTect.AspNetCore.SignalR.SqlServer.sln index 87abbf6..9752622 100644 --- a/IntelliTect.AspNetCore.SignalR.SqlServer.sln +++ b/IntelliTect.AspNetCore.SignalR.SqlServer.sln @@ -15,7 +15,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{CA676E97-1 EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntelliTect.AspNetCore.SignalR.SqlServer.Tests", "test\IntelliTect.AspNetCore.SignalR.SqlServer.Tests\IntelliTect.AspNetCore.SignalR.SqlServer.Tests.csproj", "{468B17AA-5509-481D-884E-145978311BBA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DemoBlazorServer", "demo\DemoBlazorServer\DemoBlazorServer.csproj", "{888FC3BC-2589-4A5F-8235-5737053065A6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DemoBlazorServer", "demo\DemoBlazorServer\DemoBlazorServer.csproj", "{888FC3BC-2589-4A5F-8235-5737053065A6}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0E5DD0E2-915F-4A3C-BD6A-6AA256EB1339}" + ProjectSection(SolutionItems) = preProject + .github\workflows\ci.yml = .github\workflows\ci.yml + Directory.Build.props = Directory.Build.props + README.md = README.md + .github\workflows\release.yml = .github\workflows\release.yml + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/demo/DemoBlazorServer/ChatHub.cs b/demo/DemoBlazorServer/ChatHub.cs index b421d20..13c9387 100644 --- a/demo/DemoBlazorServer/ChatHub.cs +++ b/demo/DemoBlazorServer/ChatHub.cs @@ -36,7 +36,7 @@ public override async Task OnConnectedAsync() await Groups.AddToGroupAsync(Context.ConnectionId, Guid.Empty.ToString()); } - public override async Task OnDisconnectedAsync(Exception exception) + public override async Task OnDisconnectedAsync(Exception? exception) { _logger.LogInformation(exception, $"{nameof(OnDisconnectedAsync)} called."); @@ -61,7 +61,7 @@ public async Task SendMessage(string name, string message) // _logger.LogInformation($"{nameof(SendMessage)} called. ConnectionId:{Context.ConnectionId}, Name:{name}, Message:{message}"); await Clients.Group(groupId).SendAsync("BroadcastMessage", name, "group"); await Clients.Caller.SendAsync("BroadcastMessage", name, "caller"); - await Clients.User(Context.UserIdentifier).SendAsync("BroadcastMessage", name, "user"); + await Clients.User(Context.UserIdentifier!).SendAsync("BroadcastMessage", name, "user"); await Clients.All.SendAsync("BroadcastMessage", name, "all"); await Clients.AllExcept(Context.ConnectionId).SendAsync("BroadcastMessage", name, "allExcept"); } @@ -74,7 +74,7 @@ public override async Task OnConnectedAsync() await Groups.AddToGroupAsync(Context.ConnectionId, Guid.Empty.ToString()); } - public override async Task OnDisconnectedAsync(Exception exception) + public override async Task OnDisconnectedAsync(Exception? exception) { _logger.LogInformation(exception, $"{nameof(OnDisconnectedAsync)} called."); diff --git a/demo/DemoBlazorServer/DemoBlazorServer.csproj b/demo/DemoBlazorServer/DemoBlazorServer.csproj index f80fe75..2636905 100644 --- a/demo/DemoBlazorServer/DemoBlazorServer.csproj +++ b/demo/DemoBlazorServer/DemoBlazorServer.csproj @@ -1,11 +1,4 @@ - - - net6.0 - enable - enable - - diff --git a/demo/DemoBlazorServer/Pages/ChatHub.razor b/demo/DemoBlazorServer/Pages/ChatHub.razor index 01b1696..3d4103c 100644 --- a/demo/DemoBlazorServer/Pages/ChatHub.razor +++ b/demo/DemoBlazorServer/Pages/ChatHub.razor @@ -33,7 +33,7 @@ @code { [Parameter] - public string Suffix { get; set; } + public string? Suffix { get; set; } private HubConnection? hubConnection; private List messages = new List(); diff --git a/demo/DemoBlazorServer/Program.cs b/demo/DemoBlazorServer/Program.cs index 36012ef..178e63d 100644 --- a/demo/DemoBlazorServer/Program.cs +++ b/demo/DemoBlazorServer/Program.cs @@ -12,7 +12,7 @@ builder.Services.AddSignalR() .AddSqlServer(o => { - o.ConnectionString = builder.Configuration.GetConnectionString("Default"); + o.ConnectionString = builder.Configuration.GetConnectionString("Default")!; o.AutoEnableServiceBroker = true; o.TableSlugGenerator = hubType => hubType.Name; o.TableCount = 1; diff --git a/demo/DemoServer/ChatHub.cs b/demo/DemoServer/ChatHub.cs index 4fe7bdf..b7fff05 100644 --- a/demo/DemoServer/ChatHub.cs +++ b/demo/DemoServer/ChatHub.cs @@ -38,7 +38,7 @@ public override async Task OnConnectedAsync() await Groups.AddToGroupAsync(Context.ConnectionId, Guid.Empty.ToString()); } - public override async Task OnDisconnectedAsync(Exception exception) + public override async Task OnDisconnectedAsync(Exception? exception) { _logger.LogInformation(exception, $"{nameof(OnDisconnectedAsync)} called."); @@ -63,7 +63,7 @@ public async Task SendMessage(string name, string message) // _logger.LogInformation($"{nameof(SendMessage)} called. ConnectionId:{Context.ConnectionId}, Name:{name}, Message:{message}"); await Clients.Group(groupId).SendAsync("BroadcastMessage", name, "group"); await Clients.Caller.SendAsync("BroadcastMessage", name, "caller"); - await Clients.User(Context.UserIdentifier).SendAsync("BroadcastMessage", name, "user"); + await Clients.User(Context.UserIdentifier!).SendAsync("BroadcastMessage", name, "user"); await Clients.All.SendAsync("BroadcastMessage", name, "all"); await Clients.AllExcept(Context.ConnectionId).SendAsync("BroadcastMessage", name, "allExcept"); } @@ -76,7 +76,7 @@ public override async Task OnConnectedAsync() await Groups.AddToGroupAsync(Context.ConnectionId, Guid.Empty.ToString()); } - public override async Task OnDisconnectedAsync(Exception exception) + public override async Task OnDisconnectedAsync(Exception? exception) { _logger.LogInformation(exception, $"{nameof(OnDisconnectedAsync)} called."); diff --git a/demo/DemoServer/DemoServer.csproj b/demo/DemoServer/DemoServer.csproj index a19280f..dc12f76 100644 --- a/demo/DemoServer/DemoServer.csproj +++ b/demo/DemoServer/DemoServer.csproj @@ -1,7 +1,6 @@ - net6.0 false false diff --git a/demo/DemoServer/Pages/Error.cshtml.cs b/demo/DemoServer/Pages/Error.cshtml.cs index 6b750b1..58efdee 100644 --- a/demo/DemoServer/Pages/Error.cshtml.cs +++ b/demo/DemoServer/Pages/Error.cshtml.cs @@ -13,7 +13,7 @@ namespace DemoServer.Pages [IgnoreAntiforgeryToken] public class ErrorModel : PageModel { - public string RequestId { get; set; } + public string? RequestId { get; set; } public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); diff --git a/demo/DemoServer/Startup.cs b/demo/DemoServer/Startup.cs index 359d034..63b0fff 100644 --- a/demo/DemoServer/Startup.cs +++ b/demo/DemoServer/Startup.cs @@ -25,13 +25,15 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { + string connectionString = Configuration.GetConnectionString("Default")!; + services.AddSingleton(); services.AddRazorPages(); services.AddSignalR() .AddSqlServer(o => { - o.ConnectionString = Configuration.GetConnectionString("Default"); + o.ConnectionString = connectionString; o.AutoEnableServiceBroker = true; o.TableSlugGenerator = hubType => hubType.Name; o.TableCount = 1; @@ -41,7 +43,7 @@ public void ConfigureServices(IServiceCollection services) // Example of using DI to configure options: services.AddOptions().Configure((o, config) => { - o.ConnectionString = config.GetConnectionString("Default"); + o.ConnectionString = connectionString; }); // Register specific hubs with specific backplanes: diff --git a/src/IntelliTect.AspNetCore.SignalR.SqlServer/IntelliTect.AspNetCore.SignalR.SqlServer.csproj b/src/IntelliTect.AspNetCore.SignalR.SqlServer/IntelliTect.AspNetCore.SignalR.SqlServer.csproj index ed3f7d0..8a4fe5a 100644 --- a/src/IntelliTect.AspNetCore.SignalR.SqlServer/IntelliTect.AspNetCore.SignalR.SqlServer.csproj +++ b/src/IntelliTect.AspNetCore.SignalR.SqlServer/IntelliTect.AspNetCore.SignalR.SqlServer.csproj @@ -1,19 +1,8 @@  - netstandard2.0;netcoreapp3.1;net5.0;net6.0 - 9.0 - enable true - https://github.com/IntelliTect/IntelliTect.AspNetCore.SignalR.SqlServer - git - IntelliTect-Nuget - IntelliTect - Apache-2.0 - A Microsoft SQL Server backplane for ASP.NET Core SignalR. - IntelliTect aspnetcore sqlserver signalr - true true @@ -25,7 +14,7 @@ - + all @@ -33,14 +22,9 @@ - + - - - - - diff --git a/src/IntelliTect.AspNetCore.SignalR.SqlServer/SqlServerMessageMode.cs b/src/IntelliTect.AspNetCore.SignalR.SqlServer/SqlServerMessageMode.cs index f0ed695..23f0ef3 100644 --- a/src/IntelliTect.AspNetCore.SignalR.SqlServer/SqlServerMessageMode.cs +++ b/src/IntelliTect.AspNetCore.SignalR.SqlServer/SqlServerMessageMode.cs @@ -16,17 +16,17 @@ namespace IntelliTect.AspNetCore.SignalR.SqlServer public enum SqlServerMessageMode { /// - /// Use SQL Server Service Broker for dicovering when new messages are available. + /// Use SQL Server Service Broker for discovering when new messages are available. /// ServiceBroker = 1 << 0, /// - /// Use perioid polling to discover when new messages are available. + /// Use periodic polling to discover when new messages are available. /// Polling = 1 << 1, /// - /// Use the most suitable mode for acquring messages. + /// Use the most suitable mode for acquiring messages. /// Auto = ServiceBroker | Polling, } diff --git a/test/IntelliTect.AspNetCore.SignalR.SqlServer.Tests/IntelliTect.AspNetCore.SignalR.SqlServer.Tests.csproj b/test/IntelliTect.AspNetCore.SignalR.SqlServer.Tests/IntelliTect.AspNetCore.SignalR.SqlServer.Tests.csproj index 1b8cb82..114c9ec 100644 --- a/test/IntelliTect.AspNetCore.SignalR.SqlServer.Tests/IntelliTect.AspNetCore.SignalR.SqlServer.Tests.csproj +++ b/test/IntelliTect.AspNetCore.SignalR.SqlServer.Tests/IntelliTect.AspNetCore.SignalR.SqlServer.Tests.csproj @@ -1,8 +1,6 @@  - net6.0 - false diff --git a/test/IntelliTect.AspNetCore.SignalR.SqlServer.Tests/SqlServerProtocolTests.cs b/test/IntelliTect.AspNetCore.SignalR.SqlServer.Tests/SqlServerProtocolTests.cs index f342ac7..f518d98 100644 --- a/test/IntelliTect.AspNetCore.SignalR.SqlServer.Tests/SqlServerProtocolTests.cs +++ b/test/IntelliTect.AspNetCore.SignalR.SqlServer.Tests/SqlServerProtocolTests.cs @@ -93,7 +93,7 @@ private class HubProtocolResolver : IHubProtocolResolver { public IReadOnlyList AllProtocols => new List() { new MessagePackHubProtocol() }; - public IHubProtocol GetProtocol(string protocolName, IReadOnlyList supportedProtocols) + public IHubProtocol GetProtocol(string protocolName, IReadOnlyList? supportedProtocols) { return AllProtocols[0]; }