From 0125743ae909c56e58dc59f796442a7b7c5ceae8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 29 Feb 2024 00:18:50 +0100 Subject: [PATCH 1/2] Fixing SQL Server auto-detection for linq2db queries --- .../LinqToDbQueryExecutor.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Lombiq.HelpfulLibraries.LinqToDb/LinqToDbQueryExecutor.cs b/Lombiq.HelpfulLibraries.LinqToDb/LinqToDbQueryExecutor.cs index c5462946..8dba8565 100644 --- a/Lombiq.HelpfulLibraries.LinqToDb/LinqToDbQueryExecutor.cs +++ b/Lombiq.HelpfulLibraries.LinqToDb/LinqToDbQueryExecutor.cs @@ -75,10 +75,11 @@ public static async Task LinqQueryAsync( private static string GetDatabaseProviderName(string dbName) => dbName switch { - // Using explicit string instead of LinqToDB.ProviderName.SqlServer because if the "System.Data.SqlClient" - // provider will be used it will cause "Could not load type System.Data.SqlClient.SqlCommandBuilder" - // exception. See: https://github.com/linq2db/linq2db/issues/2191#issuecomment-618450439. - "SqlServer" => "Microsoft.Data.SqlClient", + // Using a concrete SQL Server version here removes the need for an initial auto-detection query that can + // fail, see https://github.com/Lombiq/Helpful-Libraries/issues/236. This needs to be the same version + // YesSql and thus OC supports. You can check it out in YesSql's build workflow: + // https://github.com/sebastienros/yessql/blob/main/.github/workflows/build.yml. + "SqlServer" => ProviderName.SqlServer2019, "Sqlite" => ProviderName.SQLite, "MySql" => ProviderName.MySql, "PostgreSql" => ProviderName.PostgreSQL, From 15e019037b33ede91af5c9424de4985707078dd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Thu, 29 Feb 2024 00:25:05 +0100 Subject: [PATCH 2/2] Updating linq2db to v5.4.0 --- .../Lombiq.HelpfulLibraries.LinqToDb.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj index 9438c489..f4b3c744 100644 --- a/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj +++ b/Lombiq.HelpfulLibraries.LinqToDb/Lombiq.HelpfulLibraries.LinqToDb.csproj @@ -24,7 +24,7 @@ - +