Skip to content

Commit e8ede36

Browse files
refactor: Add support for .NET 10 and Entity Framework Core 10
1 parent a650b9b commit e8ede36

File tree

11 files changed

+48
-49
lines changed

11 files changed

+48
-49
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
- name: Setup .NET
4040
uses: actions/setup-dotnet@v4
4141
with:
42-
dotnet-version: "8.0.x"
42+
dotnet-version: "10.0.x"
4343

4444
- name: Restore dependencies
4545
run: dotnet restore
@@ -108,7 +108,7 @@ jobs:
108108
- name: Setup .NET SDK (for NuGet publish)
109109
uses: actions/setup-dotnet@v4
110110
with:
111-
dotnet-version: "8.0.x"
111+
dotnet-version: "10.0.x"
112112

113113
- name: NuGet login (OIDC → temp API key)
114114
id: login

.github/workflows/run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Setup .NET
2121
uses: actions/setup-dotnet@v4
2222
with:
23-
dotnet-version: '8.0.x'
23+
dotnet-version: '10.0.x'
2424

2525
- name: Restore dependencies
2626
run: dotnet restore

.github/workflows/snapshots.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
- name: Setup .NET
5454
uses: actions/setup-dotnet@v4
5555
with:
56-
dotnet-version: "8.0.x"
56+
dotnet-version: "10.0.x"
5757

5858
- name: Restore dependencies
5959
run: dotnet restore

benchmarks/Eftdb.Benchmarks/Eftdb.Benchmarks.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
</ItemGroup>
1515

1616
<ItemGroup>
17-
<PackageReference Include="BenchmarkDotNet" Version="0.15.2" />
18-
<PackageReference Include="Testcontainers.PostgreSql" Version="4.7.0" />
17+
<PackageReference Include="BenchmarkDotNet" Version="0.15.8" />
18+
<PackageReference Include="Testcontainers.PostgreSql" Version="4.9.0" />
1919
<PackageReference Include="Z.EntityFramework.Extensions.EFCore" Version="10.105.0" />
2020
</ItemGroup>
2121

benchmarks/Eftdb.Benchmarks/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This project uses **BenchmarkDotNet** to measure the performance of high-through
66

77
## Prerequisites
88

9-
- .NET 8 SDK or later
9+
- .NET 10 SDK or later
1010
- Docker
1111

1212
## Run the Benchmarks

tests/Eftdb.FunctionalTests/Eftdb.FunctionalTests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
</PackageReference>
1919
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="10.0.0" />
2020
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational.Specification.Tests" Version="10.0.0" />
21-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
21+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
2222
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.NetTopologySuite" Version="10.0.0" />
2323
<PackageReference Include="Npgsql.NetTopologySuite" Version="10.0.0" />
24-
<PackageReference Include="Testcontainers.PostgreSql" Version="4.8.1" />
24+
<PackageReference Include="Testcontainers.PostgreSql" Version="4.9.0" />
2525
<PackageReference Include="xunit" Version="2.9.3" />
2626
<PackageReference Include="xunit.assert" Version="2.9.3" />
2727
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">

tests/Eftdb.FunctionalTests/Snapshots/EfCore22ModelSnapshot.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@ protected override void BuildModel(ModelBuilder modelBuilder)
2222
.HasColumnType("integer")
2323
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
2424

25+
b.Property<int>("Bar")
26+
.HasColumnType("integer");
27+
2528
b.Property<string>("Description")
2629
.HasColumnType("text");
2730

2831
b.HasKey("Id");
2932

30-
b.ToTable("Foos");
33+
b.ToTable("Table1");
3134
});
3235
#pragma warning restore 612, 618
3336
}

tests/Eftdb.FunctionalTests/TimescaleDbMigrationsInfrastructureTests.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,22 @@ public override void Can_diff_against_2_2_model()
106106
DiffSnapshot(new EfCore22ModelSnapshot(), context);
107107
}
108108

109+
/// <summary>
110+
/// PostgreSQL/Npgsql doesn't support applying migrations within an externally-managed transaction.
111+
/// This is a known limitation - see https://github.com/npgsql/efcore.pg/issues/3407
112+
/// </summary>
113+
[ConditionalFact]
114+
public override void Can_apply_two_migrations_in_transaction()
115+
=> Assert.ThrowsAny<Exception>(() => base.Can_apply_two_migrations_in_transaction());
116+
117+
/// <summary>
118+
/// PostgreSQL/Npgsql doesn't support applying migrations within an externally-managed transaction.
119+
/// This is a known limitation - see https://github.com/npgsql/efcore.pg/issues/3407
120+
/// </summary>
121+
[ConditionalFact]
122+
public override Task Can_apply_two_migrations_in_transaction_async()
123+
=> Assert.ThrowsAnyAsync<Exception>(() => base.Can_apply_two_migrations_in_transaction_async());
124+
109125
[ConditionalFact]
110126
public override void Can_diff_against_3_0_ASP_NET_Identity_model()
111127
{

tests/Eftdb.FunctionalTests/Utils/TimescaleTestStore.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Npgsql;
55
using System.Collections.Concurrent;
66
using System.Data;
7+
using System.Data.Common;
78

89
namespace CmdScale.EntityFrameworkCore.TimescaleDB.FunctionalTests.Utils;
910

@@ -20,14 +21,14 @@ public static TimescaleTestStore Create(string name, string connectionString)
2021
=> new(name, shared: false, connectionString);
2122

2223
public static TimescaleTestStore GetOrCreateShared(string name, string connectionString)
23-
=> _sharedStores.GetOrAdd(name, _ =>
24+
=> _sharedStores.GetOrAdd(name, key =>
2425
{
2526
TimescaleTestStore store = new(name, shared: true, connectionString);
2627

2728
DbContextOptions<MigrationsInfrastructureFixtureBase.MigrationsContext> options =
2829
new DbContextOptionsBuilder<MigrationsInfrastructureFixtureBase.MigrationsContext>()
2930
.UseNpgsql(connectionString).UseTimescaleDb().Options;
30-
var __ = store.InitializeAsync(null,
31+
_ = store.InitializeAsync(null,
3132
() => new MigrationsInfrastructureFixtureBase.MigrationsContext(options), null).Result;
3233
return store;
3334
});
@@ -47,10 +48,8 @@ public void ExecuteScript(string script)
4748
if (ConnectionState != ConnectionState.Open)
4849
Connection.Open();
4950

50-
using (var cmd = Connection.CreateCommand())
51-
{
52-
cmd.CommandText = script;
53-
cmd.ExecuteNonQuery();
54-
}
51+
using DbCommand cmd = Connection.CreateCommand();
52+
cmd.CommandText = script;
53+
cmd.ExecuteNonQuery();
5554
}
5655
}

tests/Eftdb.Tests/Eftdb.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
</PackageReference>
1919
<PackageReference Include="EFCore.NamingConventions" Version="10.0.0-rc.2" />
2020
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.0" />
21-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
21+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
2222
<PackageReference Include="Moq" Version="4.20.72" />
23-
<PackageReference Include="Testcontainers.PostgreSql" Version="4.8.1" />
23+
<PackageReference Include="Testcontainers.PostgreSql" Version="4.9.0" />
2424
<PackageReference Include="xunit" Version="2.9.3" />
2525
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
2626
<PrivateAssets>all</PrivateAssets>

0 commit comments

Comments
 (0)