Skip to content

Commit

Permalink
chore: upgrade target frameworks
Browse files Browse the repository at this point in the history
  • Loading branch information
ascott18 committed Nov 1, 2023
1 parent fe94eb1 commit 14806ca
Show file tree
Hide file tree
Showing 16 changed files with 56 additions and 48 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project>
<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<LangVersion>11.0</LangVersion>
<Company>IntelliTect</Company>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>

<RepositoryUrl>https://github.com/IntelliTect/IntelliTect.AspNetCore.SignalR.SqlServer</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Authors>IntelliTect-Nuget</Authors>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<Description>A Microsoft SQL Server backplane for ASP.NET Core SignalR.</Description>
<PackageTags>IntelliTect aspnetcore sqlserver signalr</PackageTags>
</PropertyGroup>
</Project>
10 changes: 9 additions & 1 deletion IntelliTect.AspNetCore.SignalR.SqlServer.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions demo/DemoBlazorServer/ChatHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.");

Expand All @@ -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");
}
Expand All @@ -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.");

Expand Down
7 changes: 0 additions & 7 deletions demo/DemoBlazorServer/DemoBlazorServer.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.0" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion demo/DemoBlazorServer/Pages/ChatHub.razor
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

@code {
[Parameter]
public string Suffix { get; set; }
public string? Suffix { get; set; }

private HubConnection? hubConnection;
private List<string> messages = new List<string>();
Expand Down
2 changes: 1 addition & 1 deletion demo/DemoBlazorServer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions demo/DemoServer/ChatHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.");

Expand All @@ -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");
}
Expand All @@ -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.");

Expand Down
1 change: 0 additions & 1 deletion demo/DemoServer/DemoServer.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<CopyRefAssembliesToPublishDirectory>false</CopyRefAssembliesToPublishDirectory>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion demo/DemoServer/Pages/Error.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
6 changes: 4 additions & 2 deletions demo/DemoServer/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<IUserIdProvider, UserIdProvider>();

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;
Expand All @@ -41,7 +43,7 @@ public void ConfigureServices(IServiceCollection services)
// Example of using DI to configure options:
services.AddOptions<SqlServerOptions>().Configure<IConfiguration>((o, config) =>
{
o.ConnectionString = config.GetConnectionString("Default");
o.ConnectionString = connectionString;
});

// Register specific hubs with specific backplanes:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<LangVersion>9.0</LangVersion>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>

<RepositoryUrl>https://github.com/IntelliTect/IntelliTect.AspNetCore.SignalR.SqlServer</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Authors>IntelliTect-Nuget</Authors>
<Company>IntelliTect</Company>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<Description>A Microsoft SQL Server backplane for ASP.NET Core SignalR.</Description>
<PackageTags>IntelliTect aspnetcore sqlserver signalr</PackageTags>

<!-- Sourcelink: -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
Expand All @@ -25,22 +14,17 @@
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />

<PackageReference Include="MessagePack" Version="2.3.75" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="3.0.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="[3.0.0,)" />

<PackageReference Include="Nullable" Version="1.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="$(TargetFramework) != 'netstandard2.0'">
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework) == 'netstandard2.0'">
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Core" Version="1.1.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="**/*.sql" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ namespace IntelliTect.AspNetCore.SignalR.SqlServer
public enum SqlServerMessageMode
{
/// <summary>
/// Use SQL Server Service Broker for dicovering when new messages are available.
/// Use SQL Server Service Broker for discovering when new messages are available.
/// </summary>
ServiceBroker = 1 << 0,

/// <summary>
/// Use perioid polling to discover when new messages are available.
/// Use periodic polling to discover when new messages are available.
/// </summary>
Polling = 1 << 1,

/// <summary>
/// Use the most suitable mode for acquring messages.
/// Use the most suitable mode for acquiring messages.
/// </summary>
Auto = ServiceBroker | Polling,
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private class HubProtocolResolver : IHubProtocolResolver
{
public IReadOnlyList<IHubProtocol> AllProtocols => new List<IHubProtocol>() { new MessagePackHubProtocol() };

public IHubProtocol GetProtocol(string protocolName, IReadOnlyList<string> supportedProtocols)
public IHubProtocol GetProtocol(string protocolName, IReadOnlyList<string>? supportedProtocols)
{
return AllProtocols[0];
}
Expand Down

0 comments on commit 14806ca

Please sign in to comment.