diff --git a/Directory.Packages.props b/Directory.Packages.props index df290bc6d..1794fab92 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -22,7 +22,8 @@ - + + 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/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 @@ + 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..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(); } } 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 - }; - } - } - } -}