From adc1e602596c90c013659566b7b54ec4204825cb Mon Sep 17 00:00:00 2001 From: Todd Menier Date: Fri, 13 Jul 2018 10:00:49 -0500 Subject: [PATCH 1/4] Revert "Update DatabaseType.cs" This reverts commit 0a70b05ca0cc33fc373c04a5befe11f7a4eaa7e6. --- AsyncPoco/Core/DatabaseType.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/AsyncPoco/Core/DatabaseType.cs b/AsyncPoco/Core/DatabaseType.cs index e2f1abfa..45c9233d 100644 --- a/AsyncPoco/Core/DatabaseType.cs +++ b/AsyncPoco/Core/DatabaseType.cs @@ -141,11 +141,11 @@ public static DatabaseType Resolve(string TypeName, string ProviderName) case string t when t.StartsWith("mysql", StringComparison.CurrentCultureIgnoreCase): return Singleton.Instance; case string t when t.StartsWith("sqlce", StringComparison.CurrentCultureIgnoreCase): - return Singleton.Instance; - case string t when t.StartsWith("npgsql", StringComparison.CurrentCultureIgnoreCase) || t.StartsWith("pgsql", StringComparison.CurrentCultureIgnoreCase): return Singleton.Instance; - case string t when t.StartsWith("oracle", StringComparison.CurrentCultureIgnoreCase): + case string t when t.StartsWith("npgsql", StringComparison.CurrentCultureIgnoreCase) || t.StartsWith("pgsql", StringComparison.CurrentCultureIgnoreCase): return Singleton.Instance; + case string t when t.StartsWith("oracle", StringComparison.CurrentCultureIgnoreCase): + return Singleton.Instance; case string t when t.StartsWith("sqlite", StringComparison.CurrentCultureIgnoreCase): return Singleton.Instance; case string t when t.StartsWith("system.data.sqlclient.", StringComparison.CurrentCultureIgnoreCase): @@ -157,11 +157,11 @@ public static DatabaseType Resolve(string TypeName, string ProviderName) case string t when t.StartsWith("mysql", StringComparison.CurrentCultureIgnoreCase): return Singleton.Instance; case string t when t.StartsWith("sqlserverce", StringComparison.CurrentCultureIgnoreCase): - return Singleton.Instance; - case string t when t.StartsWith("pgsql", StringComparison.CurrentCultureIgnoreCase): return Singleton.Instance; - case string t when t.StartsWith("oracle", StringComparison.CurrentCultureIgnoreCase): + case string t when t.StartsWith("pgsql", StringComparison.CurrentCultureIgnoreCase): return Singleton.Instance; + case string t when t.StartsWith("oracle", StringComparison.CurrentCultureIgnoreCase): + return Singleton.Instance; case string t when t.StartsWith("sqlite", StringComparison.CurrentCultureIgnoreCase): return Singleton.Instance; // Assume SQL Server From c70438fe9244aa5e41a1b09f6a55bcdd561aaa30 Mon Sep 17 00:00:00 2001 From: Todd Menier Date: Fri, 13 Jul 2018 10:01:00 -0500 Subject: [PATCH 2/4] Revert "Fix SQLite error" This reverts commit cdbc7e9b2a5276909155be9a9543d32e9c0bbee8. --- AsyncPoco/Core/DatabaseType.cs | 40 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/AsyncPoco/Core/DatabaseType.cs b/AsyncPoco/Core/DatabaseType.cs index 45c9233d..608252b8 100644 --- a/AsyncPoco/Core/DatabaseType.cs +++ b/AsyncPoco/Core/DatabaseType.cs @@ -136,38 +136,38 @@ public virtual Task ExecuteInsertAsync(Database db, DbCommand cmd, strin public static DatabaseType Resolve(string TypeName, string ProviderName) { // Try using type name first (more reliable) - switch (TypeName) - { - case string t when t.StartsWith("mysql", StringComparison.CurrentCultureIgnoreCase): + if (!string.IsNullOrEmpty(TypeName)) { + if (TypeName.StartsWith("MySql")) return Singleton.Instance; - case string t when t.StartsWith("sqlce", StringComparison.CurrentCultureIgnoreCase): + if (TypeName.StartsWith("SqlCe")) + return Singleton.Instance; + if (TypeName.StartsWith("Npgsql") || TypeName.StartsWith("PgSql")) return Singleton.Instance; - case string t when t.StartsWith("npgsql", StringComparison.CurrentCultureIgnoreCase) || t.StartsWith("pgsql", StringComparison.CurrentCultureIgnoreCase): + if (TypeName.StartsWith("Oracle")) return Singleton.Instance; - case string t when t.StartsWith("oracle", StringComparison.CurrentCultureIgnoreCase): - return Singleton.Instance; - case string t when t.StartsWith("sqlite", StringComparison.CurrentCultureIgnoreCase): + if (TypeName.StartsWith("SQLite")) return Singleton.Instance; - case string t when t.StartsWith("system.data.sqlclient.", StringComparison.CurrentCultureIgnoreCase): + if (TypeName.StartsWith("System.Data.SqlClient.")) return Singleton.Instance; } + // Try again with provider name - switch (ProviderName) - { - case string t when t.StartsWith("mysql", StringComparison.CurrentCultureIgnoreCase): + if (!string.IsNullOrEmpty(ProviderName)) { + if (ProviderName.IndexOf("MySql", StringComparison.OrdinalIgnoreCase) >= 0) return Singleton.Instance; - case string t when t.StartsWith("sqlserverce", StringComparison.CurrentCultureIgnoreCase): + if (ProviderName.IndexOf("SqlServerCe", StringComparison.OrdinalIgnoreCase) >= 0) + return Singleton.Instance; + if (ProviderName.IndexOf("pgsql", StringComparison.OrdinalIgnoreCase) >= 0) return Singleton.Instance; - case string t when t.StartsWith("pgsql", StringComparison.CurrentCultureIgnoreCase): + if (ProviderName.IndexOf("Oracle", StringComparison.OrdinalIgnoreCase) >= 0) return Singleton.Instance; - case string t when t.StartsWith("oracle", StringComparison.CurrentCultureIgnoreCase): + if (ProviderName.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) >= 0) return Singleton.Instance; - case string t when t.StartsWith("sqlite", StringComparison.CurrentCultureIgnoreCase): - return Singleton.Instance; - // Assume SQL Server - default: - return Singleton.Instance; } + + // Assume SQL Server + return Singleton.Instance; } + } } From ca3efc1545a1edfe628652a19fb9337f8f4c4142 Mon Sep 17 00:00:00 2001 From: Todd Menier Date: Fri, 13 Jul 2018 10:05:08 -0500 Subject: [PATCH 3/4] #49 case-insensitive check for db type --- AsyncPoco/Core/DatabaseType.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/AsyncPoco/Core/DatabaseType.cs b/AsyncPoco/Core/DatabaseType.cs index 608252b8..fbd8d4d7 100644 --- a/AsyncPoco/Core/DatabaseType.cs +++ b/AsyncPoco/Core/DatabaseType.cs @@ -137,17 +137,17 @@ public static DatabaseType Resolve(string TypeName, string ProviderName) { // Try using type name first (more reliable) if (!string.IsNullOrEmpty(TypeName)) { - if (TypeName.StartsWith("MySql")) + if (TypeName.StartsWith("MySql", StringComparison.OrdinalIgnoreCase)) return Singleton.Instance; - if (TypeName.StartsWith("SqlCe")) + if (TypeName.StartsWith("SqlCe", StringComparison.OrdinalIgnoreCase)) return Singleton.Instance; - if (TypeName.StartsWith("Npgsql") || TypeName.StartsWith("PgSql")) + if (TypeName.StartsWith("Npgsql", StringComparison.OrdinalIgnoreCase) || TypeName.StartsWith("PgSql", StringComparison.OrdinalIgnoreCase)) return Singleton.Instance; - if (TypeName.StartsWith("Oracle")) + if (TypeName.StartsWith("Oracle", StringComparison.OrdinalIgnoreCase)) return Singleton.Instance; - if (TypeName.StartsWith("SQLite")) + if (TypeName.StartsWith("SQLite", StringComparison.OrdinalIgnoreCase)) return Singleton.Instance; - if (TypeName.StartsWith("System.Data.SqlClient.")) + if (TypeName.StartsWith("System.Data.SqlClient.", StringComparison.OrdinalIgnoreCase)) return Singleton.Instance; } From 02863e6a0387faff4fbb607f0725248b2bc55f13 Mon Sep 17 00:00:00 2001 From: Todd Menier Date: Fri, 13 Jul 2018 10:06:57 -0500 Subject: [PATCH 4/4] version bump --- AsyncPoco/AsyncPoco.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AsyncPoco/AsyncPoco.csproj b/AsyncPoco/AsyncPoco.csproj index 559e575b..527c9bda 100644 --- a/AsyncPoco/AsyncPoco.csproj +++ b/AsyncPoco/AsyncPoco.csproj @@ -2,7 +2,7 @@ AsyncPoco - 2.0.0 + 2.0.1 net45;netstandard1.3;netstandard2.0 True Todd Menier