From 87166325d286d674c08f979494c97d9788156803 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 2 Apr 2026 19:50:37 +0000 Subject: [PATCH 1/5] Update dependency linq2db.SqlServer to v6 --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index df290bc6d..e7af3a682 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -22,7 +22,7 @@ - + From f878ae7affcff976cdfd2cd8d21f2937da66da03 Mon Sep 17 00:00:00 2001 From: CodeLogicAI Date: Thu, 2 Apr 2026 19:58:56 +0000 Subject: [PATCH 2/5] Add linq2db package reference for v6 compatibility In linq2db v6, the linq2db.SqlServer package became a template-only package and no longer includes the runtime library as a dependency. This adds an explicit reference to the linq2db package (v6.2.1) to provide the runtime functionality required by the benchmarks. Changes: - Add linq2db v6.2.1 to Directory.Packages.props - Add linq2db package reference to Dapper.Tests.Performance.csproj This fixes build errors where LinqToDB namespace types could not be found. --- Directory.Packages.props | 1 + .../Dapper.Tests.Performance/Dapper.Tests.Performance.csproj | 1 + 2 files changed, 2 insertions(+) diff --git a/Directory.Packages.props b/Directory.Packages.props index e7af3a682..1794fab92 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -22,6 +22,7 @@ + diff --git a/benchmarks/Dapper.Tests.Performance/Dapper.Tests.Performance.csproj b/benchmarks/Dapper.Tests.Performance/Dapper.Tests.Performance.csproj index 78dd70c0a..40395f837 100644 --- a/benchmarks/Dapper.Tests.Performance/Dapper.Tests.Performance.csproj +++ b/benchmarks/Dapper.Tests.Performance/Dapper.Tests.Performance.csproj @@ -16,6 +16,7 @@ + From f5702cb89b453b364061b7c432c1dd8ef66e36cb Mon Sep 17 00:00:00 2001 From: CodeLogicAI Date: Fri, 3 Apr 2026 15:40:21 +0000 Subject: [PATCH 3/5] Add documentation for linq2db v6 upgrade This document provides a comprehensive summary of the breaking changes and required modifications when upgrading from linq2db.SqlServer v5 to v6. The documentation includes: - Overview of the package structure change - Required code changes with examples - Migration guide for other projects - References to release notes and documentation --- LINQ2DB_V6_UPGRADE.md | 103 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 LINQ2DB_V6_UPGRADE.md diff --git a/LINQ2DB_V6_UPGRADE.md b/LINQ2DB_V6_UPGRADE.md new file mode 100644 index 000000000..449b65baf --- /dev/null +++ b/LINQ2DB_V6_UPGRADE.md @@ -0,0 +1,103 @@ +# linq2db.SqlServer v6 Upgrade Summary + +## Overview + +This document summarizes the changes required to upgrade from `linq2db.SqlServer` version 5.4.1.9 to version 6.2.1. + +## Breaking Changes + +### linq2db.SqlServer Package Structure Change + +In **linq2db v6**, the `linq2db.SqlServer` package underwent a significant architectural change: + +- **v5.x and earlier**: The `linq2db.SqlServer` package included both T4 scaffolding templates AND the runtime library (`linq2db`) as a transitive dependency. +- **v6.x**: The `linq2db.SqlServer` package is now a **template-only package** containing only T4 scaffolding templates. It no longer includes the runtime library as a dependency. + +This means that projects upgrading to v6 must explicitly reference the `linq2db` runtime package. + +## Required Changes + +### 1. Add linq2db Runtime Package + +**File: `Directory.Packages.props`** + +Added explicit reference to the `linq2db` runtime package: + +```xml + + +``` + +### 2. Update Project References + +**File: `benchmarks/Dapper.Tests.Performance/Dapper.Tests.Performance.csproj`** + +Added explicit package reference to the runtime library: + +```xml + + +``` + +## Why This Change Was Necessary + +Without the explicit `linq2db` package reference, the project fails to build with errors such as: + +``` +error CS0246: The type or namespace name 'LinqToDB' could not be found +(are you missing a using directive or an assembly reference?) +``` + +This occurs because: +1. The code uses types from the `LinqToDB` namespace (e.g., `DataConnection`, `ILinqToDBSettings`, `ITable`) +2. These types are provided by the `linq2db` runtime package +3. In v6, `linq2db.SqlServer` no longer brings in the runtime package automatically + +## Affected Code + +The following files use linq2db runtime types and require the `linq2db` package: + +- `benchmarks/Dapper.Tests.Performance/Benchmarks.Linq2DB.cs` +- `benchmarks/Dapper.Tests.Performance/Linq2DB/Linq2DBContext.cs` +- `benchmarks/Dapper.Tests.Performance/Linq2DB/Linq2DbSettings.cs` +- `benchmarks/Dapper.Tests.Performance/Linq2DB/ConnectionStringSettings.cs` +- `benchmarks/Dapper.Tests.Performance/Post.cs` + +## Target Frameworks + +The changes support all project target frameworks: +- .NET Framework 4.6.2 (net462) +- .NET 8.0 (net8.0) +- .NET 10.0 (net10.0) + +## New Features in v6 + +According to the release notes, linq2db v6 includes: + +- .NET 10 support +- Support for new .NET 6-10 LINQ operators: `CountBy`, `Index`, `MaxBy`, `MinBy`, `ExceptBy`, `UnionBy`, `IntersectBy` +- Improved translation of aggregate and window functions +- `string.Join` translation support +- Various SQL generation improvements +- Enhanced support for SQL Server 2025 VECTOR types + +## Verification + +The upgrade has been verified by: +1. Successful restoration of all NuGet packages +2. Successful compilation for all target frameworks (net462, net8.0, net10.0) +3. Zero build warnings or errors + +## Migration Guide for Other Projects + +If you have other projects using `linq2db.SqlServer` and are upgrading to v6: + +1. Add the `linq2db` package to your package dependencies with the same version as `linq2db.SqlServer` +2. Add a `PackageReference` to `linq2db` in your project file +3. Rebuild and verify compilation + +## References + +- [linq2db v6.0.0 Release Notes](https://github.com/linq2db/linq2db/releases/tag/v6.0.0) +- [linq2db v6.2.1 Release Notes](https://github.com/linq2db/linq2db/releases/tag/v6.2.1) +- [linq2db Documentation](https://linq2db.github.io/) From 900a96d642c3af055fde70a3e02fda2457d34598 Mon Sep 17 00:00:00 2001 From: CodeLogicAI Date: Mon, 6 Apr 2026 16:20:06 +0000 Subject: [PATCH 4/5] Modernize linq2db configuration to use DataOptions pattern Updated linq2db code to use the modern DataOptions configuration pattern introduced in v6, replacing the legacy ILinqToDBSettings approach. Changes: - Replace DataConnection.DefaultSettings with DataOptions pattern - Use UseSqlServer() extension method for SQL Server configuration - Add DataOptions constructor to Linq2DBContext - Remove dependency on legacy Linq2DBSettings class Benefits: - Follows linq2db v6 best practices and recommended patterns - Improves code maintainability and clarity - Uses immutable configuration objects - Aligns with official linq2db documentation The legacy Linq2DBSettings and ConnectionStringSettings classes are now obsolete but retained for potential future reference. --- benchmarks/Dapper.Tests.Performance/Benchmarks.Linq2DB.cs | 8 ++++++-- .../Dapper.Tests.Performance/Linq2DB/Linq2DBContext.cs | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/benchmarks/Dapper.Tests.Performance/Benchmarks.Linq2DB.cs b/benchmarks/Dapper.Tests.Performance/Benchmarks.Linq2DB.cs index cb9aaacd2..b238be7e6 100644 --- a/benchmarks/Dapper.Tests.Performance/Benchmarks.Linq2DB.cs +++ b/benchmarks/Dapper.Tests.Performance/Benchmarks.Linq2DB.cs @@ -4,7 +4,9 @@ using System.Linq; using Dapper.Tests.Performance.Linq2Db; using LinqToDB; +using LinqToDB.Configuration; using LinqToDB.Data; +using LinqToDB.DataProvider.SqlServer; using System.ComponentModel; namespace Dapper.Tests.Performance @@ -20,8 +22,10 @@ public class LinqToDBBenchmarks : BenchmarkBase // note To not 2 because the "2" public void Setup() { BaseSetup(); - DataConnection.DefaultSettings = new Linq2DBSettings(_connection.ConnectionString); - _dbContext = new Linq2DBContext(); + // Use modern DataOptions pattern for linq2db v6 + var options = new DataOptions() + .UseSqlServer(_connection.ConnectionString); + _dbContext = new Linq2DBContext(options); } [Benchmark(Description = "First")] diff --git a/benchmarks/Dapper.Tests.Performance/Linq2DB/Linq2DBContext.cs b/benchmarks/Dapper.Tests.Performance/Linq2DB/Linq2DBContext.cs index 43d491786..0b8697bb6 100644 --- a/benchmarks/Dapper.Tests.Performance/Linq2DB/Linq2DBContext.cs +++ b/benchmarks/Dapper.Tests.Performance/Linq2DB/Linq2DBContext.cs @@ -1,9 +1,14 @@ using LinqToDB; +using LinqToDB.Configuration; namespace Dapper.Tests.Performance.Linq2Db { public class Linq2DBContext : LinqToDB.Data.DataConnection { + public Linq2DBContext(DataOptions options) : base(options) + { + } + public ITable Posts => this.GetTable(); } } From 182e69182edc49ed1e6e8ca6cd0c53aa7e9e187d Mon Sep 17 00:00:00 2001 From: CodeLogicAI Date: Mon, 6 Apr 2026 17:03:06 +0000 Subject: [PATCH 5/5] Remove unused legacy linq2db configuration classes Removed Linq2DBSettings and ConnectionStringSettings classes that are no longer needed after modernizing to the DataOptions pattern in v6. Changes: - Delete benchmarks/Dapper.Tests.Performance/Linq2DB/Linq2DbSettings.cs - Delete benchmarks/Dapper.Tests.Performance/Linq2DB/ConnectionStringSettings.cs These classes implemented the legacy ILinqToDBSettings interface which has been replaced by the modern DataOptions configuration pattern in linq2db v6. They are no longer referenced anywhere in the codebase. --- .../Linq2DB/ConnectionStringSettings.cs | 12 ------- .../Linq2DB/Linq2DbSettings.cs | 34 ------------------- 2 files changed, 46 deletions(-) delete mode 100644 benchmarks/Dapper.Tests.Performance/Linq2DB/ConnectionStringSettings.cs delete mode 100644 benchmarks/Dapper.Tests.Performance/Linq2DB/Linq2DbSettings.cs diff --git a/benchmarks/Dapper.Tests.Performance/Linq2DB/ConnectionStringSettings.cs b/benchmarks/Dapper.Tests.Performance/Linq2DB/ConnectionStringSettings.cs deleted file mode 100644 index cf2ebc062..000000000 --- a/benchmarks/Dapper.Tests.Performance/Linq2DB/ConnectionStringSettings.cs +++ /dev/null @@ -1,12 +0,0 @@ -using LinqToDB.Configuration; - -namespace Dapper.Tests.Performance.Linq2Db -{ - public class ConnectionStringSettings : IConnectionStringSettings - { - public string ConnectionString { get; set; } - public string Name { get; set; } - public string ProviderName { get; set; } - public bool IsGlobal => false; - } -} \ No newline at end of file diff --git a/benchmarks/Dapper.Tests.Performance/Linq2DB/Linq2DbSettings.cs b/benchmarks/Dapper.Tests.Performance/Linq2DB/Linq2DbSettings.cs deleted file mode 100644 index 4c8103b76..000000000 --- a/benchmarks/Dapper.Tests.Performance/Linq2DB/Linq2DbSettings.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using LinqToDB.Configuration; - -namespace Dapper.Tests.Performance.Linq2Db -{ - public class Linq2DBSettings : ILinqToDBSettings - { - private readonly string _connectionString; - public IEnumerable DataProviders => Enumerable.Empty(); - - public string DefaultConfiguration => "SqlServer"; - public string DefaultDataProvider => "SqlServer"; - - public Linq2DBSettings(string connectionString) - { - _connectionString = connectionString; - } - - public IEnumerable ConnectionStrings - { - get - { - yield return - new ConnectionStringSettings - { - Name = "SqlServer", - ProviderName = "SqlServer", - ConnectionString = _connectionString - }; - } - } - } -}