Skip to content

Commit

Permalink
chore: Update to .NET 9
Browse files Browse the repository at this point in the history
This builds, but unsure of runtime issues because there's 0 tests
  • Loading branch information
carlreid committed Feb 13, 2025
1 parent c54bbd2 commit 4ad5c76
Show file tree
Hide file tree
Showing 30 changed files with 148 additions and 193 deletions.
6 changes: 1 addition & 5 deletions BuildClientAPI/BuildClientAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="X.PagedList" Version="10.5.3" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\StreamMaster.API\StreamMaster.API.csproj" />
<ProjectReference Include="..\StreamMaster.Application\StreamMaster.Application.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.base
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Set the base image for the ASP.NET Core application
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base

# Define build-time arguments for platform and architecture
ARG TARGETARCH
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
ARG TARGETPLATFORM
ARG TARGETOS
ARG TARGETARCH
Expand Down
2 changes: 0 additions & 2 deletions StreamMaster.API/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,3 @@
global using StreamMaster.Domain.Services;
global using StreamMaster.Streams.Domain.Interfaces;
global using StreamMaster.Streams.Domain.Models;

global using X.PagedList;
23 changes: 16 additions & 7 deletions StreamMaster.API/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -319,23 +319,32 @@ static string GetRoutePattern(Endpoint endpoint)
: "<unknown>";
}

static X509Certificate2 ValidateSslCertificate(string cert, string password)
static X509Certificate2 ValidateSslCertificate(string certPath, string password)
{
X509Certificate2 certificate;

try
{
certificate = new X509Certificate2(cert, password, X509KeyStorageFlags.DefaultKeySet);
var limits = new Pkcs12LoaderLimits();
var certificate = X509CertificateLoader.LoadPkcs12FromFile(
certPath,
password,
X509KeyStorageFlags.DefaultKeySet,
limits);

return certificate == null ? throw new CryptographicException("No valid certificate found in the file.") : certificate;
}
catch (FileNotFoundException)
{
throw new Exception($"The SSL certificate file {certPath} does not exist.");
}
catch (CryptographicException ex)
{
if (ex.HResult is 0x2 or 0x2006D080)
{
throw new Exception($"The SSL certificate file {cert} does not exist: {ex.Message}");
throw new Exception($"The SSL certificate file {certPath} does not exist: {ex.Message}");
}

throw;
}
}


return certificate;
}
20 changes: 8 additions & 12 deletions StreamMaster.API/StreamMaster.API.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<NoWarn>ASP0023</NoWarn>
Expand Down Expand Up @@ -52,17 +52,13 @@
<PackageReference Include="MessagePack" Version="2.5.187" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="6.0.0" />
<PackageReference Include="NSwag.AspNetCore" Version="14.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.10" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.10" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="8.0.10" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="8.0.10" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageReference Include="Reinforced.Typings" Version="1.6.3" />
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" />
<PackageReference Include="System.Runtime.Caching" Version="8.0.1" />
<PackageReference Include="System.Security.Cryptography.Xml" Version="8.0.2" />
<PackageReference Include="X.PagedList" Version="10.5.3" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="9.0.2" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.2" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="9.0.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.2" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="9.0.2" />
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.2" />
<PackageReference Include="Reinforced.Typings" Version="1.6.5" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\StreamMaster.Infrastructure\StreamMaster.Infrastructure.csproj" />
Expand Down
4 changes: 1 addition & 3 deletions StreamMaster.Application/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,4 @@
global using StreamMaster.SchedulesDirect.Domain.XmltvXml;
global using StreamMaster.Streams.Domain.Interfaces;
global using StreamMaster.Streams.Domain.Models;
global using StreamMaster.Streams.Domain.Statistics;

global using X.PagedList;
global using StreamMaster.Streams.Domain.Statistics;
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Text.Json;

using X.Extensions.PagedList.EF;
using X.PagedList;

namespace StreamMaster.Application.SchedulesDirect.Queries;

Expand Down
14 changes: 6 additions & 8 deletions StreamMaster.Application/StreamMaster.Application.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>AnyCPU;ARM64</Platforms>
Expand Down Expand Up @@ -66,13 +66,11 @@
<ItemGroup>
<PackageReference Include="AspectInjector" Version="2.8.2" />
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.10.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.10" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.1" />
<PackageReference Include="X.PagedList" Version="10.5.3" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.11.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\StreamMaster.Domain\StreamMaster.Domain.csproj" />
Expand Down
1 change: 1 addition & 0 deletions StreamMaster.Domain/API/PagedResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using StreamMaster.Domain.Attributes;

using System.Xml.Serialization;
using X.PagedList;

namespace StreamMaster.Domain.API;

Expand Down
4 changes: 1 addition & 3 deletions StreamMaster.Domain/Extensions/PagedExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using AutoMapper;

using Microsoft.EntityFrameworkCore;

using StreamMaster.Domain.API;
using StreamMaster.Domain.Filtering;

using X.Extensions.PagedList.EF;
using X.PagedList;
namespace StreamMaster.Domain.Extensions;

public static class PagedExtensions
Expand Down
4 changes: 1 addition & 3 deletions StreamMaster.Domain/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@
global using StreamMaster.Domain.Dto;
global using StreamMaster.Domain.Enums;
global using StreamMaster.Domain.Mappings;
global using StreamMaster.Domain.Models;

global using X.PagedList;
global using StreamMaster.Domain.Models;
4 changes: 1 addition & 3 deletions StreamMaster.Domain/Repository/IRepositoryBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,8 @@ public interface IRepositoryBase<T> where T : class
/// Performs a bulk update operation.
/// </summary>
/// <param name="entities">Entities to update.</param>
void BulkUpdate(T[] entities);

void BulkUpdate(List<T> entities);
Task BulkUpdateAsync<TEntity>(IEnumerable<TEntity> entities) where TEntity : class;

/// <summary>
/// Performs a bulk delete operation based on the provided query.
/// </summary>
Expand Down
1 change: 0 additions & 1 deletion StreamMaster.Domain/Repository/IRepositoryContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public interface IRepositoryContext
Task BulkInsertEntitiesAsync<TEntity>(IEnumerable<TEntity> entities) where TEntity : class;
int ExecuteSqlRaw(string sql, params object[] parameters);
Task<int> ExecuteSqlRawAsync(string sql, CancellationToken cancellationToken = default);
void BulkUpdateEntities<TEntity>(IEnumerable<TEntity> entities) where TEntity : class;
void BulkInsertEntities<TEntity>(IEnumerable<TEntity> entities) where TEntity : class;
Task BulkDeleteAsyncEntities<TEntity>(IQueryable<TEntity> entities, CancellationToken cancellationToken = default) where TEntity : class;
DbSet<ChannelGroup> ChannelGroups
Expand Down
27 changes: 13 additions & 14 deletions StreamMaster.Domain/StreamMaster.Domain.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>AnyCPU;ARM64</Platforms>
Expand All @@ -27,20 +27,19 @@
<ItemGroup>
<PackageReference Include="AspectInjector" Version="2.8.2" />
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="Azure.Identity" Version="1.13.0" />
<PackageReference Include="EFCore.BulkExtensions" Version="8.1.1" />
<PackageReference Include="Azure.Identity" Version="1.13.2" />
<PackageReference Include="MediatR" Version="12.4.1" />
<PackageReference Include="MessagePack.Annotations" Version="2.5.187" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.EntityFrameworkCore" Version="8.0.10" />
<PackageReference Include="Reinforced.Typings" Version="1.6.3" />
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.4.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Features" Version="8.0.10" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
<PackageReference Include="MessagePack.Annotations" Version="3.1.3" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.EntityFrameworkCore" Version="9.0.2" />
<PackageReference Include="Reinforced.Typings" Version="1.6.5" />
<PackageReference Include="System.Formats.Asn1" Version="9.0.2" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.6.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.2" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.2" />
<PackageReference Include="Microsoft.Extensions.Features" Version="9.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.2" />
<PackageReference Include="System.Text.Json" Version="9.0.2" />
<PackageReference Include="X.Extensions.PagedList.EF" Version="10.1.2" />
<PackageReference Include="X.PagedList" Version="10.5.3" />
<PackageReference Include="X.PagedList" Version="10.5.7" />
</ItemGroup>
</Project>
25 changes: 11 additions & 14 deletions StreamMaster.Infrastructure.EF.Base/BaseRepositoryContext.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using EFCore.BulkExtensions;

using Microsoft.AspNetCore.DataProtection.EntityFrameworkCore;
using Microsoft.Data.Sqlite;
using Microsoft.AspNetCore.DataProtection.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.Data.Sqlite;

namespace StreamMaster.Infrastructure.EF.Base;

Expand Down Expand Up @@ -50,28 +48,27 @@ public Task<IDbContextTransaction> BeginTransactionAsync(CancellationToken cance
return Database.BeginTransactionAsync(cancellationToken);
}

public void BulkUpdateEntities<TEntity>(IEnumerable<TEntity> entities) where TEntity : class
{
this.BulkUpdate(entities);
}

public void BulkInsertEntities<TEntity>(IEnumerable<TEntity> entities) where TEntity : class
{
this.BulkInsert(entities);
AddRange(entities);
SaveChanges();
}

public async Task BulkInsertEntitiesAsync<TEntity>(IEnumerable<TEntity> entities) where TEntity : class
{
await this.BulkInsertAsync(entities);
await AddRangeAsync(entities);
await SaveChangesAsync();
}

public async Task BulkUpdateAsync<TEntity>(IEnumerable<TEntity> entities) where TEntity : class
{
await BulkUpdateAsync(entities);
UpdateRange(entities);
await SaveChangesAsync();
}

public Task BulkDeleteAsyncEntities<TEntity>(IQueryable<TEntity> entities, CancellationToken cancellationToken = default) where TEntity : class
{
return entities.ExecuteDeleteAsync(cancellationToken);
return EntityFrameworkQueryableExtensions.ExecuteDeleteAsync(entities, cancellationToken);
}

public bool IsEntityTracked<TEntity>(TEntity entity) where TEntity : class
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EFCore.BulkExtensions" Version="8.1.1" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
<PackageReference Include="X.PagedList" Version="10.5.3" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="9.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.2" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.3" />
<PackageReference Include="System.Text.Json" Version="9.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand All @@ -14,21 +14,19 @@
<None Remove="Extensions\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.13.0" />
<PackageReference Include="EFCore.BulkExtensions" Version="8.1.1" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.2" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.10" />
<PackageReference Include="Azure.Identity" Version="1.13.2" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.0.1" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.3" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="1.1.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime" Version="8.0.10" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.4.6" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.EntityFrameworkCore" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime" Version="9.0.3" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.6.0.2" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.EntityFrameworkCore" Version="9.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageReference Include="X.PagedList" Version="10.5.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\StreamMaster.Application\StreamMaster.Application.csproj" />
Expand Down
2 changes: 0 additions & 2 deletions StreamMaster.Infrastructure.EF/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@
global using StreamMaster.Domain.Pagination;
global using StreamMaster.Domain.Repository;
global using StreamMaster.Domain.Services;

global using X.PagedList;
Loading

0 comments on commit 4ad5c76

Please sign in to comment.