Skip to content

Commit d05477f

Browse files
author
fabien.menager
committed
Bypass Mysql packages while Pomelo is not updated
1 parent 2be93ce commit d05477f

9 files changed

Lines changed: 43 additions & 8 deletions

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ jobs:
5252
- name: Test net9.0
5353
run: dotnet test --configuration Release --no-restore --no-build --verbosity normal --framework net9.0
5454

55+
- name: Test net10.0
56+
run: dotnet test --configuration Release --no-restore --no-build --verbosity normal --framework net10.0
57+
5558
- name: Pack nuget packages
5659
run: dotnet pack --configuration Release --no-restore --no-build --output nupkgs /p:PackageVersion=$VERSION
5760

Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@
2929
<!-- Pomelo.EntityFrameworkCore.MySql.NetTopologySuite is not yet available for .NET 10.0 -->
3030
<MysqlSupported>true</MysqlSupported>
3131
<MysqlSupported Condition="'$(TargetFramework)' == 'net10.0'">false</MysqlSupported>
32+
<Constants Condition="'$(MysqlSupported)' == 'true'">$(Constants);MYSQL_SUPPORTED</Constants>
3233
</PropertyGroup>
3334
</Project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"solution": {
3+
"path": "PhenX.EntityFrameworkCore.BulkInsert.slnx",
4+
"projects": [
5+
"src\\PhenX.EntityFrameworkCore.BulkInsert.Oracle\\PhenX.EntityFrameworkCore.BulkInsert.Oracle.csproj",
6+
"src\\PhenX.EntityFrameworkCore.BulkInsert.PostgreSql\\PhenX.EntityFrameworkCore.BulkInsert.PostgreSql.csproj",
7+
"src\\PhenX.EntityFrameworkCore.BulkInsert.Sqlite\\PhenX.EntityFrameworkCore.BulkInsert.Sqlite.csproj",
8+
"src\\PhenX.EntityFrameworkCore.BulkInsert.SqlServer\\PhenX.EntityFrameworkCore.BulkInsert.SqlServer.csproj",
9+
"src\\PhenX.EntityFrameworkCore.BulkInsert\\PhenX.EntityFrameworkCore.BulkInsert.csproj",
10+
"tests\\PhenX.EntityFrameworkCore.BulkInsert.Benchmark\\PhenX.EntityFrameworkCore.BulkInsert.Benchmark.csproj",
11+
"tests\\PhenX.EntityFrameworkCore.BulkInsert.Tests\\PhenX.EntityFrameworkCore.BulkInsert.Tests.csproj"
12+
]
13+
}
14+
}

src/PhenX.EntityFrameworkCore.BulkInsert.MySql/PhenX.EntityFrameworkCore.BulkInsert.MySql.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2+
23
<PropertyGroup>
34
<TargetFrameworks>net8.0;net9.0</TargetFrameworks> <!-- net10.0 not supported by Pomelo.EntityFrameworkCore.MySql yet -->
4-
<!-- Ignore error for preview version of Pomelo.EntityFrameworkCore.MySql -->
5-
<NoWarn>$(NoWarn);NU5104</NoWarn>
65
</PropertyGroup>
76

87
<ItemGroup>

tests/PhenX.EntityFrameworkCore.BulkInsert.Benchmark/LibComparator.RawInsert.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
using Microsoft.Data.Sqlite;
55
using Microsoft.EntityFrameworkCore;
66

7+
#if MYSQL_SUPPORTED
78
using MySqlConnector;
9+
#endif
810

911
using Npgsql;
1012

@@ -144,6 +146,7 @@ private void RawInsertSqlServer()
144146
}
145147
}
146148

149+
#if MYSQL_SUPPORTED
147150
private void RawInsertMySql()
148151
{
149152
var connection = (MySqlConnection)DbContext.Database.GetDbConnection();
@@ -196,6 +199,7 @@ private void RawInsertMySql()
196199
bulkCopy.WriteToServer(dataTable);
197200
}
198201
}
202+
#endif
199203

200204
private void RawInsertOracle()
201205
{

tests/PhenX.EntityFrameworkCore.BulkInsert.Benchmark/LibComparator.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,13 @@ public void RawInsert()
8585
// Use BeginBinaryImport for PostgreSQL
8686
RawInsertPostgreSql();
8787
}
88+
#if MYSQL_SUPPORTED
8889
else if (DbContext.Database.ProviderName!.Contains("MySql", StringComparison.InvariantCultureIgnoreCase))
8990
{
9091
// Use MySqlBulkCopy for PostgreSQL
9192
RawInsertMySql();
9293
}
94+
#endif
9395
else if (DbContext.Database.ProviderName!.Contains("Oracle", StringComparison.InvariantCultureIgnoreCase))
9496
{
9597
// Use OracleBulkCopy for Oracle

tests/PhenX.EntityFrameworkCore.BulkInsert.Benchmark/PhenX.EntityFrameworkCore.BulkInsert.Benchmark.csproj

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFrameworks>net9.0;</TargetFrameworks> <!-- Override TargetFrameworks (with an s) from Directory.Build.props -->
65
<IsPackable>false</IsPackable>
6+
<IsTestProject>false</IsTestProject>
77
</PropertyGroup>
88

99
<ItemGroup>
@@ -26,8 +26,18 @@
2626
<PackageReference Include="linq2db.EntityFrameworkCore" Version="9.2.0" />
2727
</ItemGroup>
2828

29+
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
30+
<PackageReference Include="EFCore.BulkExtensions" Version="10.0.0" />
31+
<PackageReference Include="Z.EntityFramework.Extensions.EFCore" Version="10.105.2" />
32+
<PackageReference Include="linq2db.EntityFrameworkCore" Version="10.1.0" />
33+
</ItemGroup>
34+
35+
<ItemGroup Label="Exclude MySql code" Condition="'$(MysqlSupported)' != 'true'">
36+
<Compile Remove="**\*MySql*.cs" />
37+
</ItemGroup>
38+
2939
<ItemGroup>
30-
<ProjectReference Include="..\..\src\PhenX.EntityFrameworkCore.BulkInsert.MySql\PhenX.EntityFrameworkCore.BulkInsert.MySql.csproj" />
40+
<ProjectReference Include="..\..\src\PhenX.EntityFrameworkCore.BulkInsert.MySql\PhenX.EntityFrameworkCore.BulkInsert.MySql.csproj" Condition="'$(MysqlSupported)' == 'true'" />
3141
<ProjectReference Include="..\..\src\PhenX.EntityFrameworkCore.BulkInsert.PostgreSql\PhenX.EntityFrameworkCore.BulkInsert.PostgreSql.csproj" />
3242
<ProjectReference Include="..\..\src\PhenX.EntityFrameworkCore.BulkInsert.Sqlite\PhenX.EntityFrameworkCore.BulkInsert.Sqlite.csproj" />
3343
<ProjectReference Include="..\..\src\PhenX.EntityFrameworkCore.BulkInsert.SqlServer\PhenX.EntityFrameworkCore.BulkInsert.SqlServer.csproj" />

tests/PhenX.EntityFrameworkCore.BulkInsert.Benchmark/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ public static void Main(string[] args)
1919
// Library comparison benchmarks
2020
var comparators = new[]
2121
{
22+
#if MYSQL_SUPPORTED
2223
typeof(LibComparatorMySql),
24+
#endif
2325
typeof(LibComparatorPostgreSql),
2426
typeof(LibComparatorSqlite),
2527
typeof(LibComparatorSqlServer),

tests/PhenX.EntityFrameworkCore.BulkInsert.Tests/PhenX.EntityFrameworkCore.BulkInsert.Tests.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121
<PackageReference Include="Xunit.SkippableFact" Version="1.5.23" />
2222
</ItemGroup>
2323

24-
<ItemGroup Label="Exclude MySql tests" Condition="'$(MysqlSupported)' != 'true'">
25-
<Compile Remove="**\*MySql*.cs" />
26-
</ItemGroup>
27-
2824
<ItemGroup Label="Test containers">
2925
<PackageReference Include="Testcontainers" Version="4.7.0" />
3026
<PackageReference Include="Testcontainers.PostgreSql" Version="4.7.0" />
@@ -55,6 +51,10 @@
5551
<PackageReference Include="Ardalis.SmartEnum.EFCore" Version="8.2.0" />
5652
</ItemGroup>
5753

54+
<ItemGroup Label="Exclude MySql code" Condition="'$(MysqlSupported)' != 'true'">
55+
<Compile Remove="**\*MySql*.cs" />
56+
</ItemGroup>
57+
5858
<ItemGroup>
5959
<ProjectReference Include="..\..\src\PhenX.EntityFrameworkCore.BulkInsert.MySql\PhenX.EntityFrameworkCore.BulkInsert.MySql.csproj" Condition="'$(MysqlSupported)' == 'true'" />
6060
<ProjectReference Include="..\..\src\PhenX.EntityFrameworkCore.BulkInsert.Oracle\PhenX.EntityFrameworkCore.BulkInsert.Oracle.csproj" />

0 commit comments

Comments
 (0)