From 228aa140cab42b2786440aaa9de1519f53fddfd5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 17 Apr 2026 17:22:05 +0000 Subject: [PATCH 1/3] 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 f54799dde1edd022ce1020082307f672d6346a26 Mon Sep 17 00:00:00 2001 From: CodeLogicAI Date: Fri, 17 Apr 2026 17:30:20 +0000 Subject: [PATCH 2/3] Add linq2db package for linq2db.SqlServer v6.2.1 upgrade The linq2db.SqlServer package v6.2.1 is a scaffolding package (T4 templates) that requires the main linq2db package to be referenced separately for runtime functionality. Added linq2db v6.2.1 to Directory.Packages.props and updated Dapper.Tests.Performance.csproj to reference both packages. The main linq2db package v6.2.1 supports .NET Framework 4.6.2+ and .NET Standard 2.0+, ensuring compatibility with all target frameworks used in this project. --- 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 494aad00036de242f73aaacdf5693141cd93bf02 Mon Sep 17 00:00:00 2001 From: CodeLogicAI Date: Fri, 17 Apr 2026 18:37:00 +0000 Subject: [PATCH 3/3] Modernize linq2db usage to v6 recommended patterns This commit modernizes the linq2db benchmark code to use v6+ recommended patterns and removes deprecated APIs: Changes: - Replace deprecated DataConnection.DefaultSettings with DataOptions pattern - Update Linq2DBContext to use DataOptions constructor (v6+ recommended) - Remove obsolete Linq2DBSettings and ConnectionStringSettings classes - Use fluent UseSqlServer() configuration method Benefits: - Aligns with linq2db v6 best practices and performance optimizations - Simplifies configuration by removing custom ILinqToDBSettings implementation - Leverages v6's improved connection management and reduced stack usage - Prepares codebase for future linq2db enhancements The new DataOptions pattern is the recommended approach in linq2db v6+ for configuring database connections, replacing the legacy DefaultSettings API which has been deprecated. References: - https://github.com/linq2db/linq2db/wiki/Linq-To-DB-6 - https://linq2db.github.io/articles/get-started/asp-dotnet-core/ --- .../Benchmarks.Linq2DB.cs | 8 +++-- .../Linq2DB/ConnectionStringSettings.cs | 12 ------- .../Linq2DB/Linq2DBContext.cs | 8 ++++- .../Linq2DB/Linq2DbSettings.cs | 34 ------------------- 4 files changed, 13 insertions(+), 49 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/Benchmarks.Linq2DB.cs b/benchmarks/Dapper.Tests.Performance/Benchmarks.Linq2DB.cs index cb9aaacd2..ac43cdee3 100644 --- a/benchmarks/Dapper.Tests.Performance/Benchmarks.Linq2DB.cs +++ b/benchmarks/Dapper.Tests.Performance/Benchmarks.Linq2DB.cs @@ -4,6 +4,7 @@ using System.Linq; using Dapper.Tests.Performance.Linq2Db; using LinqToDB; +using LinqToDB.Configuration; using LinqToDB.Data; using System.ComponentModel; @@ -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 _options; 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 (linq2db v6+ recommended pattern) instead of DefaultSettings + _options = new DataOptions() + .UseSqlServer(_connection.ConnectionString); + _dbContext = new Linq2DBContext(_options); } [Benchmark(Description = "First")] 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/Linq2DBContext.cs b/benchmarks/Dapper.Tests.Performance/Linq2DB/Linq2DBContext.cs index 43d491786..9c7ba9f21 100644 --- a/benchmarks/Dapper.Tests.Performance/Linq2DB/Linq2DBContext.cs +++ b/benchmarks/Dapper.Tests.Performance/Linq2DB/Linq2DBContext.cs @@ -1,9 +1,15 @@ using LinqToDB; +using LinqToDB.Configuration; +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(); } } 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 - }; - } - } - } -}