From ebd1612041bb92d1a7803340dc352f27a13edc5d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 7 Apr 2026 13:59:40 +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 45df8b7a7a6cbfa67280500a7b3404f33297a309 Mon Sep 17 00:00:00 2001 From: CodeLogicAI Date: Tue, 7 Apr 2026 14:08:37 +0000 Subject: [PATCH 2/5] Add linq2db package reference for linq2db.SqlServer v6 compatibility In linq2db v6, the linq2db.SqlServer package no longer includes the main linq2db library as a dependency. Added explicit reference to linq2db 6.2.1 package to ensure the performance benchmarks project can compile with all required linq2db assemblies. Changes: - Added linq2db 6.2.1 package version to Directory.Packages.props - Added linq2db PackageReference to Dapper.Tests.Performance.csproj This resolves 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 fde9e0d489476687b39181f1358f657d3bff2122 Mon Sep 17 00:00:00 2001 From: CodeLogicAI Date: Tue, 7 Apr 2026 15:18:43 +0000 Subject: [PATCH 3/5] Modernize linq2db configuration to use DataOptions builder pattern Updated the linq2db integration to use the DataOptions builder pattern, which is the recommended approach in linq2db v6. This provides better performance and follows best practices. Key changes: - Replaced legacy ILinqToDBSettings configuration with DataOptions - Updated Linq2DBContext to accept DataOptions in constructor - Modified benchmark setup to use UseSqlServer() builder method - Removed dependency on DefaultSettings static configuration Benefits: - More explicit and testable configuration - Better performance with immutable options - Aligns with linq2db v6 best practices and future-proofs the code - Eliminates use of obsolete constructor patterns References: - https://github.com/linq2db/linq2db/wiki/Linq-To-DB-6 - https://github.com/linq2db/linq2db/issues/3940 --- .../Dapper.Tests.Performance/Benchmarks.Linq2DB.cs | 10 +++++++--- .../Dapper.Tests.Performance/Linq2DB/Linq2DBContext.cs | 7 ++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/benchmarks/Dapper.Tests.Performance/Benchmarks.Linq2DB.cs b/benchmarks/Dapper.Tests.Performance/Benchmarks.Linq2DB.cs index cb9aaacd2..8664e4a2c 100644 --- a/benchmarks/Dapper.Tests.Performance/Benchmarks.Linq2DB.cs +++ b/benchmarks/Dapper.Tests.Performance/Benchmarks.Linq2DB.cs @@ -1,11 +1,12 @@ using BenchmarkDotNet.Attributes; using System; +using System.ComponentModel; using System.Linq; using Dapper.Tests.Performance.Linq2Db; using LinqToDB; using LinqToDB.Data; -using System.ComponentModel; +using LinqToDB.DataProvider.SqlServer; namespace Dapper.Tests.Performance { @@ -13,6 +14,7 @@ namespace Dapper.Tests.Performance public class LinqToDBBenchmarks : BenchmarkBase // note To not 2 because the "2" confuses BDN CLI { private Linq2DBContext _dbContext; + private DataOptions _dataOptions; private static readonly Func compiledQuery = CompiledQuery.Compile((Linq2DBContext db, int id) => db.Posts.First(c => c.Id == id)); @@ -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 DataOptions builder pattern (recommended approach in linq2db v6) + _dataOptions = new DataOptions() + .UseSqlServer(_connection.ConnectionString); + _dbContext = new Linq2DBContext(_dataOptions); } [Benchmark(Description = "First")] diff --git a/benchmarks/Dapper.Tests.Performance/Linq2DB/Linq2DBContext.cs b/benchmarks/Dapper.Tests.Performance/Linq2DB/Linq2DBContext.cs index 43d491786..aa632b810 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.Data; namespace Dapper.Tests.Performance.Linq2Db { - public class Linq2DBContext : LinqToDB.Data.DataConnection + public class Linq2DBContext : DataConnection { + public Linq2DBContext(DataOptions options) : base(options) + { + } + public ITable Posts => this.GetTable(); } } From f25421d219fad2f86e8155180b2954767af1e32c Mon Sep 17 00:00:00 2001 From: CodeLogicAI Date: Tue, 14 Apr 2026 13:32:34 +0000 Subject: [PATCH 4/5] Document legacy linq2db configuration classes as obsolete Marked Linq2DBSettings and ConnectionStringSettings as obsolete with clear documentation directing developers to use the DataOptions builder pattern introduced in linq2db v6. These classes are retained for backward compatibility and reference but should not be used in new code. The obsolete attributes and documentation comments guide developers to the modern implementation in Benchmarks.Linq2DB.cs. Changes: - Added [Obsolete] attribute to Linq2DBSettings class - Added [Obsolete] attribute to ConnectionStringSettings class - Added XML documentation comments explaining the deprecation - Referenced the modern DataOptions pattern implementation This ensures code documentation is aligned with the v6 upgrade changes. --- .../Linq2DB/ConnectionStringSettings.cs | 8 +++++++- .../Dapper.Tests.Performance/Linq2DB/Linq2DbSettings.cs | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/benchmarks/Dapper.Tests.Performance/Linq2DB/ConnectionStringSettings.cs b/benchmarks/Dapper.Tests.Performance/Linq2DB/ConnectionStringSettings.cs index cf2ebc062..93fb4b0b3 100644 --- a/benchmarks/Dapper.Tests.Performance/Linq2DB/ConnectionStringSettings.cs +++ b/benchmarks/Dapper.Tests.Performance/Linq2DB/ConnectionStringSettings.cs @@ -1,7 +1,13 @@ -using LinqToDB.Configuration; +using System; +using LinqToDB.Configuration; namespace Dapper.Tests.Performance.Linq2Db { + /// + /// Legacy configuration class for linq2db. Obsolete as of linq2db v6. + /// Use DataOptions builder pattern instead. See Benchmarks.Linq2DB.cs for the modern approach. + /// + [Obsolete("Use DataOptions builder pattern instead. This class is retained for reference only.")] public class ConnectionStringSettings : IConnectionStringSettings { public string ConnectionString { get; set; } diff --git a/benchmarks/Dapper.Tests.Performance/Linq2DB/Linq2DbSettings.cs b/benchmarks/Dapper.Tests.Performance/Linq2DB/Linq2DbSettings.cs index 4c8103b76..22d150174 100644 --- a/benchmarks/Dapper.Tests.Performance/Linq2DB/Linq2DbSettings.cs +++ b/benchmarks/Dapper.Tests.Performance/Linq2DB/Linq2DbSettings.cs @@ -1,9 +1,15 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using LinqToDB.Configuration; namespace Dapper.Tests.Performance.Linq2Db { + /// + /// Legacy configuration class for linq2db. Obsolete as of linq2db v6. + /// Use DataOptions builder pattern instead. See Benchmarks.Linq2DB.cs for the modern approach. + /// + [Obsolete("Use DataOptions builder pattern instead. This class is retained for reference only.")] public class Linq2DBSettings : ILinqToDBSettings { private readonly string _connectionString; From bafb1178d9c9c85aa8878af829ec1a394f15c81a Mon Sep 17 00:00:00 2001 From: CodeLogicAI Date: Tue, 14 Apr 2026 14:17:31 +0000 Subject: [PATCH 5/5] Remove unused legacy linq2db configuration classes Removed Linq2DBSettings and ConnectionStringSettings classes as they are no longer used after migrating to the DataOptions builder pattern in linq2db v6. These classes were part of the legacy ILinqToDBSettings configuration approach which has been replaced by the modern DataOptions pattern in Benchmarks.Linq2DB.cs. Changes: - Deleted benchmarks/Dapper.Tests.Performance/Linq2DB/Linq2DbSettings.cs - Deleted benchmarks/Dapper.Tests.Performance/Linq2DB/ConnectionStringSettings.cs This cleanup removes unnecessary code and simplifies the codebase. --- .../Linq2DB/ConnectionStringSettings.cs | 18 --------- .../Linq2DB/Linq2DbSettings.cs | 40 ------------------- 2 files changed, 58 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 93fb4b0b3..000000000 --- a/benchmarks/Dapper.Tests.Performance/Linq2DB/ConnectionStringSettings.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using LinqToDB.Configuration; - -namespace Dapper.Tests.Performance.Linq2Db -{ - /// - /// Legacy configuration class for linq2db. Obsolete as of linq2db v6. - /// Use DataOptions builder pattern instead. See Benchmarks.Linq2DB.cs for the modern approach. - /// - [Obsolete("Use DataOptions builder pattern instead. This class is retained for reference only.")] - 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 22d150174..000000000 --- a/benchmarks/Dapper.Tests.Performance/Linq2DB/Linq2DbSettings.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using LinqToDB.Configuration; - -namespace Dapper.Tests.Performance.Linq2Db -{ - /// - /// Legacy configuration class for linq2db. Obsolete as of linq2db v6. - /// Use DataOptions builder pattern instead. See Benchmarks.Linq2DB.cs for the modern approach. - /// - [Obsolete("Use DataOptions builder pattern instead. This class is retained for reference only.")] - 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 - }; - } - } - } -}