Skip to content

Commit 4a631ef

Browse files
committed
feat: migrate to net 10
1 parent bfc2349 commit 4a631ef

21 files changed

+161
-164
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Setup .NET
3535
uses: actions/setup-dotnet@v4
3636
with:
37-
dotnet-version: "9.0.x"
37+
dotnet-version: "10.0.x"
3838

3939
- name: Initialize CodeQL
4040
uses: github/codeql-action/init@v3

.github/workflows/dotnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Setup .NET
3131
uses: actions/setup-dotnet@v4
3232
with:
33-
dotnet-version: "9.0.x"
33+
dotnet-version: "10.0.x"
3434

3535
- name: Restore dependencies
3636
run: dotnet restore Shop.sln

.github/workflows/sonar-cloud.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Setup .NET
2828
uses: actions/setup-dotnet@v4
2929
with:
30-
dotnet-version: "9.0.x"
30+
dotnet-version: "10.0.x"
3131

3232
- uses: actions/checkout@v4
3333
with:

Directory.Packages.props

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -22,36 +22,35 @@
2222
<PackageVersion Include="CorrelationId" Version="3.0.*" />
2323
<PackageVersion Include="coverlet.collector" Version="6.0.*" />
2424
<PackageVersion Include="coverlet.msbuild" Version="6.0.*" />
25-
<PackageVersion Include="FluentAssertions" Version="7.1.0" />
25+
<PackageVersion Include="FluentAssertions" Version="8.8.*" />
2626
<PackageVersion Include="FluentValidation.DependencyInjectionExtensions" Version="12.*" />
2727
<PackageVersion Include="FluentValidation" Version="12.*" />
2828
<PackageVersion Include="MediatR" Version="13.1.*" />
29-
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.*" />
30-
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="9.*" />
31-
<PackageVersion Include="Microsoft.EntityFrameworkCore.Analyzers" Version="9.*" />
32-
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="9.*" />
33-
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.*" />
34-
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="9.*" />
35-
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.*" />
36-
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.*" />
37-
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="9.*" />
38-
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="9.*" />
39-
<PackageVersion Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="9.*" />
40-
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.*" />
41-
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="9.*" />
42-
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.*" />
43-
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.*" />
44-
<PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="9.*" />
45-
<PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="9.*" />
46-
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.*" />
47-
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.*" />
48-
<PackageVersion Include="Microsoft.Extensions.Http" Version="9.*" />
49-
<PackageVersion Include="Microsoft.Extensions.Identity.Core" Version="9.*" />
50-
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="9.*" />
51-
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.*" />
52-
<PackageVersion Include="Microsoft.Extensions.Options.DataAnnotations" Version="9.*" />
53-
<PackageVersion Include="Microsoft.Extensions.Options" Version="9.*" />
54-
<PackageVersion Include="Microsoft.Extensions.Primitives" Version="9.*" />
29+
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.*" />
30+
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="10.0.*" />
31+
<PackageVersion Include="Microsoft.EntityFrameworkCore.Analyzers" Version="10.0.*" />
32+
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.*" />
33+
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="10.0.*" />
34+
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="10.0.*" />
35+
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.*" />
36+
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.*" />
37+
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.*" />
38+
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="10.0.*" />
39+
<PackageVersion Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="10.0.*" />
40+
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.*" />
41+
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="10.0.*" />
42+
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.*" />
43+
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.*" />
44+
<PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="10.0.*" />
45+
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.*" />
46+
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.*" />
47+
<PackageVersion Include="Microsoft.Extensions.Http" Version="10.0.*" />
48+
<PackageVersion Include="Microsoft.Extensions.Identity.Core" Version="10.0.*" />
49+
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.*" />
50+
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="10.0.*" />
51+
<PackageVersion Include="Microsoft.Extensions.Options.DataAnnotations" Version="10.0.*" />
52+
<PackageVersion Include="Microsoft.Extensions.Options" Version="10.0.*" />
53+
<PackageVersion Include="Microsoft.Extensions.Primitives" Version="10.0.*" />
5554
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.*" />
5655
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.*" />
5756
<PackageVersion Include="MiniProfiler.AspNetCore.Mvc" Version="4.5.*" />
@@ -67,9 +66,7 @@
6766
<PackageVersion Include="Roslynator.Formatting.Analyzers" Version="4.*" />
6867
<PackageVersion Include="Roslynator.Refactorings" Version="4.*" />
6968
<PackageVersion Include="Scalar.AspNetCore" Version="2.*" />
70-
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="9.0.*" />
71-
<PackageVersion Include="System.Text.Json" Version="9.0.*" />
72-
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.*" />
69+
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="10.0.*" />
7370
<PackageVersion Include="xunit.analyzers" Version="1.25.*" />
7471
<PackageVersion Include="xunit.categories" Version="3.0.*" />
7572
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.*" />

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ If you liked this project, learned something, give it a star. Thank you!
2626

2727
## **Technologies**
2828

29-
- ~~ASP.NET Core 8~~
30-
- ASP.NET Core 9
31-
- ~~Entity Framework Core 8~~
32-
- Entity Framework Core 9
29+
- ASP.NET Core 10
30+
- Entity Framework Core 10
3331
- **EF Compiled Queries** (https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/ef/language-reference/compiled-queries-linq-to-entities)
3432
- Unit & Integration Tests + xUnit + FluentAssertions (7.1.0)
3533
- xUnit (https://github.com/xunit/xunit)

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "9.0.305",
3+
"version": "10.0.100",
44
"rollForward": "latestMajor",
55
"allowPrerelease": false
66
}

src/Shop.Application/Shop.Application.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
2+
33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
</PropertyGroup>
6-
6+
77
<ItemGroup>
88
<PackageReference Include="Ardalis.Result.FluentValidation" />
99
<PackageReference Include="Ardalis.Result" />
@@ -32,10 +32,10 @@
3232
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3333
</PackageReference>
3434
</ItemGroup>
35-
35+
3636
<ItemGroup>
3737
<ProjectReference Include="..\Shop.Domain\Shop.Domain.csproj" />
3838
<ProjectReference Include="..\Shop.Core\Shop.Core.csproj" />
3939
</ItemGroup>
40-
40+
4141
</Project>

src/Shop.Core/Extensions/AssemblyExtensions.cs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@ namespace Shop.Core.Extensions;
77

88
public static class AssemblyExtensions
99
{
10-
/// <summary>
11-
/// Retrieves all types in the specified assembly that implement or inherit from a given interface or base class.
12-
/// </summary>
13-
/// <typeparam name="TInterface">The interface or base class type.</typeparam>
14-
/// <param name="assembly">The assembly to search in.</param>
15-
/// <returns>An enumerable collection of types that implement or inherit from the specified interface or base class.</returns>
16-
public static IEnumerable<Type> GetAllTypesOf<TInterface>(this Assembly assembly)
10+
extension<TInterface>(Assembly assembly)
1711
{
18-
var isAssignableToTInterface = typeof(TInterface).IsAssignableFrom;
19-
return [.. assembly
20-
.GetTypes()
21-
.Where(type => type.IsClass && !type.IsAbstract && !type.IsInterface && isAssignableToTInterface(type))];
12+
/// <summary>
13+
/// Retrieves all types in the specified assembly that implement or inherit from a given interface or base class.
14+
/// </summary>
15+
/// <returns>An enumerable collection of types that implement or inherit from the specified interface or base class.</returns>
16+
public IEnumerable<Type> GetAllTypesOf()
17+
{
18+
var isAssignableToTInterface = typeof(TInterface).IsAssignableFrom;
19+
20+
return assembly
21+
.GetTypes()
22+
.Where(type => type.IsClass && !type.IsAbstract && !type.IsInterface && isAssignableToTInterface(type));
23+
}
2224
}
2325
}

src/Shop.Core/Extensions/ConfigurationExtensions.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ namespace Shop.Core.Extensions;
55

66
public static class ConfigurationExtensions
77
{
8-
/// <summary>
9-
/// Get options from IConfiguration object.
10-
/// </summary>
11-
/// <typeparam name="TOptions">The type of options to retrieve.</typeparam>
12-
/// <param name="configuration">The IConfiguration object.</param>
13-
/// <returns>The options object.</returns>
14-
public static TOptions GetOptions<TOptions>(this IConfiguration configuration)
15-
where TOptions : class, IAppOptions
8+
extension<TOptions>(IConfiguration configuration) where TOptions : class, IAppOptions
169
{
17-
return configuration
18-
.GetRequiredSection(TOptions.ConfigSectionPath)
19-
.Get<TOptions>(options => options.BindNonPublicProperties = true);
10+
/// <summary>
11+
/// Get options from IConfiguration object.
12+
/// </summary>
13+
/// <returns>The options object.</returns>
14+
public TOptions GetOptions()
15+
{
16+
return configuration
17+
.GetRequiredSection(TOptions.ConfigSectionPath)
18+
.Get<TOptions>(options => options.BindNonPublicProperties = true);
19+
}
2020
}
2121
}

src/Shop.Core/Extensions/GenericTypeExtensions.cs

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,30 @@ namespace Shop.Core.Extensions;
44

55
public static class GenericTypeExtensions
66
{
7-
public static bool IsDefault<T>(this T value) =>
8-
Equals(value, default(T));
7+
extension<T>(T value)
8+
{
9+
public bool IsDefault() => Equals(value, default(T));
10+
}
911

10-
/// <summary>
11-
/// Returns the name of the generic type of the object.
12-
/// </summary>
13-
/// <param name="object">The object to get the generic type name from.</param>
14-
/// <returns>The name of the generic type.</returns>
15-
public static string GetGenericTypeName(this object @object)
12+
extension(object @object)
1613
{
17-
var type = @object.GetType();
14+
/// <summary>
15+
/// Returns the name of the generic type of the object.
16+
/// </summary>
17+
/// <returns>The name of the generic type.</returns>
18+
public string GetGenericTypeName()
19+
{
20+
var type = @object.GetType();
1821

19-
// Check if the type is not generic
20-
if (!type.IsGenericType)
21-
return type.Name;
22+
// Check if the type is not generic
23+
if (!type.IsGenericType)
24+
return type.Name;
2225

23-
// Get the names of the generic arguments and join them with commas
24-
var genericTypes = string.Join(",", type.GetGenericArguments().Select(t => t.Name).ToArray());
26+
// Get the names of the generic arguments and join them with commas
27+
var genericTypes = string.Join(",", type.GetGenericArguments().Select(t => t.Name).ToArray());
2528

26-
// Remove the backtick and append the generic arguments to the type name
27-
return $"{type.Name[..type.Name.IndexOf('`')]}<{genericTypes}>";
29+
// Remove the backtick and append the generic arguments to the type name
30+
return $"{type.Name[..type.Name.IndexOf('`')]}<{genericTypes}>";
31+
}
2832
}
2933
}

0 commit comments

Comments
 (0)