From 6505fd5b13bf3c8157ed47b4f6abbe0dd3733d50 Mon Sep 17 00:00:00 2001 From: Roma Date: Sun, 11 Jan 2026 12:10:33 +0100 Subject: [PATCH 1/8] Add support for BigInteger, Int128, and UInt128 in SqliteValueBinder - Bind Int128, UInt128, and BigInteger parameters as TEXT in SQLite. - Add provider-level tests to verify correct binding of these large numeric types. - This change only affects parameter binding; reading values back still returns string. --- .../SqliteValueBinder.cs | 23 +++++++++ .../SqliteParameterTest.cs | 49 +++++++++++++++++++ 2 files changed, 72 insertions(+) diff --git a/src/Microsoft.Data.Sqlite.Core/SqliteValueBinder.cs b/src/Microsoft.Data.Sqlite.Core/SqliteValueBinder.cs index 40cdbeb32c6..8d88f9d329c 100644 --- a/src/Microsoft.Data.Sqlite.Core/SqliteValueBinder.cs +++ b/src/Microsoft.Data.Sqlite.Core/SqliteValueBinder.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Globalization; +using System.Numerics; using Microsoft.Data.Sqlite.Properties; namespace Microsoft.Data.Sqlite; @@ -228,6 +229,22 @@ public virtual void Bind() var value1 = (long)(ushort)value; BindInt64(value1); } + else if (type == typeof(BigInteger)) + { + BindText(((BigInteger)value).ToString(CultureInfo.InvariantCulture)); + } +#if NET7_0_OR_GREATER + else if (type == typeof(Int128)) + { + var value1 = (Int128)value; + BindText((value1).ToString(CultureInfo.InvariantCulture)); + } + else if (type == typeof(UInt128)) + { + var value1 = (UInt128)value; + BindText((value1).ToString(CultureInfo.InvariantCulture)); + } +#endif else { throw new InvalidOperationException(Resources.UnknownDataType(type)); @@ -247,7 +264,13 @@ public virtual void Bind() { typeof(DateOnly), SqliteType.Text }, { typeof(TimeOnly), SqliteType.Text }, #endif + { typeof(DBNull), SqliteType.Text }, + { typeof(BigInteger), SqliteType.Text }, +#if NET7_0_OR_GREATER + { typeof(Int128), SqliteType.Text }, + { typeof(UInt128), SqliteType.Text }, +#endif { typeof(decimal), SqliteType.Text }, { typeof(double), SqliteType.Real }, { typeof(float), SqliteType.Real }, diff --git a/test/Microsoft.Data.Sqlite.Tests/SqliteParameterTest.cs b/test/Microsoft.Data.Sqlite.Tests/SqliteParameterTest.cs index 97accd942af..1133dc0822c 100644 --- a/test/Microsoft.Data.Sqlite.Tests/SqliteParameterTest.cs +++ b/test/Microsoft.Data.Sqlite.Tests/SqliteParameterTest.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Data; using System.Data.Common; +using System.Numerics; using Microsoft.Data.Sqlite.Properties; using Microsoft.Data.Sqlite.TestUtilities; using Xunit; @@ -570,6 +571,54 @@ public void Add_range_of_parameters_using_DbCommand_base_class() } } + [Fact] + public void Bind_BigInteger_parameter_as_text() + { + using (var connection = new SqliteConnection("Data Source=:memory:")) + { + var command = connection.CreateCommand(); + command.CommandText = "SELECT @Parameter;"; + var value = BigInteger.Parse("1234567890123456789012345678901234567890"); + command.Parameters.AddWithValue("@Parameter", value); + connection.Open(); + var result = (string)command.ExecuteScalar()!; + Assert.Equal("1234567890123456789012345678901234567890", result); + } + } + + +#if NET7_0_OR_GREATER + [Fact] + public void Bind_Int128_parameter_as_text() + { + using (var connection = new SqliteConnection("Data Source=:memory:")) + { + var command = connection.CreateCommand(); + command.CommandText = "SELECT @Parameter;"; + var value = Int128.Parse("170141183460469231731687303715884105727"); + command.Parameters.AddWithValue("@Parameter", value); + connection.Open(); + var result = (string)command.ExecuteScalar()!; + Assert.Equal("170141183460469231731687303715884105727", result); + } + } + + [Fact] + public void Bind_UInt128_parameter_as_text() + { + using (var connection = new SqliteConnection("Data Source=:memory:")) + { + var command = connection.CreateCommand(); + command.CommandText = "SELECT @Parameter;"; + var value = UInt128.Parse("340282366920938463463374607431768211455"); + command.Parameters.AddWithValue("@Parameter", value); + connection.Open(); + var result = (string)command.ExecuteScalar()!; + Assert.Equal("340282366920938463463374607431768211455", result); + } + } +#endif + public static IEnumerable TypesData => new List { From 17b9daf612a6642d612842ba98a1fcdc2c2aabf8 Mon Sep 17 00:00:00 2001 From: Roma Date: Thu, 5 Feb 2026 22:02:58 +0100 Subject: [PATCH 2/8] Update src/Microsoft.Data.Sqlite.Core/SqliteValueBinder.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/Microsoft.Data.Sqlite.Core/SqliteValueBinder.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.Data.Sqlite.Core/SqliteValueBinder.cs b/src/Microsoft.Data.Sqlite.Core/SqliteValueBinder.cs index f90cf9d859d..4d98d243e7a 100644 --- a/src/Microsoft.Data.Sqlite.Core/SqliteValueBinder.cs +++ b/src/Microsoft.Data.Sqlite.Core/SqliteValueBinder.cs @@ -246,13 +246,11 @@ public virtual void Bind() #if NET7_0_OR_GREATER else if (type == typeof(Int128)) { - var value1 = (Int128)value; - BindText((value1).ToString(CultureInfo.InvariantCulture)); + BindText(((Int128)value).ToString(CultureInfo.InvariantCulture)); } else if (type == typeof(UInt128)) { - var value1 = (UInt128)value; - BindText((value1).ToString(CultureInfo.InvariantCulture)); + BindText(((UInt128)value).ToString(CultureInfo.InvariantCulture)); } #endif else From 4ad4fb1efe3907e8df1b435a30b7fb5a38b91f13 Mon Sep 17 00:00:00 2001 From: Roma Date: Sun, 1 Mar 2026 23:03:16 +0100 Subject: [PATCH 3/8] Create sync.yml --- .github/workflows/sync.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/sync.yml diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml new file mode 100644 index 00000000000..16443f65c34 --- /dev/null +++ b/.github/workflows/sync.yml @@ -0,0 +1,18 @@ +name: Auto Sync Fork + +on: + schedule: + - cron: '*/30 * * * *' # перевіряє кожні 30 хвилин + workflow_dispatch: + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - name: Sync fork + uses: aormsby/Fork-Sync-With-Upstream-action@v3.4 + with: + upstream_sync_repo: ORIGINAL_OWNER/ORIGINAL_REPO + upstream_sync_branch: main + target_sync_branch: main + target_repo_token: ${{ secrets.GITHUB_TOKEN }} From 3fab19adeedbce0234179d99e451a9ffa0494600 Mon Sep 17 00:00:00 2001 From: Roma Date: Sun, 1 Mar 2026 23:04:43 +0100 Subject: [PATCH 4/8] Update sync.yml --- .github/workflows/sync.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index 16443f65c34..c21be2c15c4 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -2,13 +2,19 @@ name: Auto Sync Fork on: schedule: - - cron: '*/30 * * * *' # перевіряє кожні 30 хвилин + - cron: '*/30 * * * *' workflow_dispatch: jobs: sync: runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: main + fetch-depth: 0 + - name: Sync fork uses: aormsby/Fork-Sync-With-Upstream-action@v3.4 with: From 3e2f0e007ac987c7dcae24bb625657bf95efe8b2 Mon Sep 17 00:00:00 2001 From: Roma Date: Sun, 1 Mar 2026 23:06:42 +0100 Subject: [PATCH 5/8] Update TestCosmos.yaml --- .github/workflows/TestCosmos.yaml | 51 ++++++++++--------------------- 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/.github/workflows/TestCosmos.yaml b/.github/workflows/TestCosmos.yaml index 7b5199fea05..0133744434b 100644 --- a/.github/workflows/TestCosmos.yaml +++ b/.github/workflows/TestCosmos.yaml @@ -1,43 +1,24 @@ -name: Test Cosmos +name: Auto Sync Fork on: - push: - branches: - - main - - feature/* - - release/* - pull_request: - branches: - - main - - feature/* - - release/* - -permissions: {} + schedule: + - cron: '*/30 * * * *' + workflow_dispatch: jobs: - build: - runs-on: windows-latest - + sync: + runs-on: ubuntu-latest steps: - - name: Start Cosmos Emulator - run: | - Import-Module "$env:ProgramFiles\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator" - Start-CosmosDbEmulator -Timeout 540 -NoUI -NoTelemetry -NoFirewall -EnablePreview - - name: Checkout - uses: actions/checkout@v6 - - - name: Restore - run: restore.cmd - shell: cmd - - - name: Test on Cosmos - run: dotnet test test/EFCore.Cosmos.FunctionalTests/EFCore.Cosmos.FunctionalTests.csproj - shell: cmd + uses: actions/checkout@v4 + with: + ref: main + fetch-depth: 0 - - name: Publish Test Results - uses: actions/upload-artifact@v7 - if: always() + - name: Sync fork + uses: aormsby/Fork-Sync-With-Upstream-action@v3.4 with: - name: test-results - path: artifacts/log/Debug/* + upstream_sync_repo: dotnet/efcore + upstream_sync_branch: main + target_sync_branch: main + target_repo_token: ${{ secrets.GITHUB_TOKEN }} From d38816343dca4e34136bc1b13311605e9cdea1ec Mon Sep 17 00:00:00 2001 From: Roma Date: Sun, 1 Mar 2026 23:09:46 +0100 Subject: [PATCH 6/8] Update TestCosmos.yaml --- .github/workflows/TestCosmos.yaml | 51 +++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/.github/workflows/TestCosmos.yaml b/.github/workflows/TestCosmos.yaml index 0133744434b..7b5199fea05 100644 --- a/.github/workflows/TestCosmos.yaml +++ b/.github/workflows/TestCosmos.yaml @@ -1,24 +1,43 @@ -name: Auto Sync Fork +name: Test Cosmos on: - schedule: - - cron: '*/30 * * * *' - workflow_dispatch: + push: + branches: + - main + - feature/* + - release/* + pull_request: + branches: + - main + - feature/* + - release/* + +permissions: {} jobs: - sync: - runs-on: ubuntu-latest + build: + runs-on: windows-latest + steps: + - name: Start Cosmos Emulator + run: | + Import-Module "$env:ProgramFiles\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator" + Start-CosmosDbEmulator -Timeout 540 -NoUI -NoTelemetry -NoFirewall -EnablePreview + - name: Checkout - uses: actions/checkout@v4 - with: - ref: main - fetch-depth: 0 + uses: actions/checkout@v6 + + - name: Restore + run: restore.cmd + shell: cmd + + - name: Test on Cosmos + run: dotnet test test/EFCore.Cosmos.FunctionalTests/EFCore.Cosmos.FunctionalTests.csproj + shell: cmd - - name: Sync fork - uses: aormsby/Fork-Sync-With-Upstream-action@v3.4 + - name: Publish Test Results + uses: actions/upload-artifact@v7 + if: always() with: - upstream_sync_repo: dotnet/efcore - upstream_sync_branch: main - target_sync_branch: main - target_repo_token: ${{ secrets.GITHUB_TOKEN }} + name: test-results + path: artifacts/log/Debug/* From ae8b251dee08bcf6c7fef84007a97dc70c1fd78f Mon Sep 17 00:00:00 2001 From: Roma Date: Sun, 1 Mar 2026 23:10:19 +0100 Subject: [PATCH 7/8] Update sync.yml --- .github/workflows/sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index c21be2c15c4..0133744434b 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -18,7 +18,7 @@ jobs: - name: Sync fork uses: aormsby/Fork-Sync-With-Upstream-action@v3.4 with: - upstream_sync_repo: ORIGINAL_OWNER/ORIGINAL_REPO + upstream_sync_repo: dotnet/efcore upstream_sync_branch: main target_sync_branch: main target_repo_token: ${{ secrets.GITHUB_TOKEN }} From 48138a4804956e1099bdd78a7924b4aefb475e08 Mon Sep 17 00:00:00 2001 From: Roma Date: Sun, 1 Mar 2026 23:19:33 +0100 Subject: [PATCH 8/8] Delete .github/workflows/sync.yml --- .github/workflows/sync.yml | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 .github/workflows/sync.yml diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml deleted file mode 100644 index 0133744434b..00000000000 --- a/.github/workflows/sync.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Auto Sync Fork - -on: - schedule: - - cron: '*/30 * * * *' - workflow_dispatch: - -jobs: - sync: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: main - fetch-depth: 0 - - - name: Sync fork - uses: aormsby/Fork-Sync-With-Upstream-action@v3.4 - with: - upstream_sync_repo: dotnet/efcore - upstream_sync_branch: main - target_sync_branch: main - target_repo_token: ${{ secrets.GITHUB_TOKEN }}