Skip to content

Commit

Permalink
Merge pull request #52 from tmenier/dev
Browse files Browse the repository at this point in the history
2.0.1
  • Loading branch information
tmenier authored Jul 13, 2018
2 parents 079123c + 02863e6 commit 14caa45
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion AsyncPoco/AsyncPoco.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<PackageId>AsyncPoco</PackageId>
<Version>2.0.0</Version>
<Version>2.0.1</Version>
<TargetFrameworks>net45;netstandard1.3;netstandard2.0</TargetFrameworks>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Authors>Todd Menier</Authors>
Expand Down
36 changes: 18 additions & 18 deletions AsyncPoco/Core/DatabaseType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,38 +136,38 @@ public virtual Task<object> 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", StringComparison.OrdinalIgnoreCase))
return Singleton<MySqlDatabaseType>.Instance;
case string t when t.StartsWith("sqlce", StringComparison.CurrentCultureIgnoreCase):
if (TypeName.StartsWith("SqlCe", StringComparison.OrdinalIgnoreCase))
return Singleton<SqlServerCEDatabaseType>.Instance;
case string t when t.StartsWith("npgsql", StringComparison.CurrentCultureIgnoreCase) || t.StartsWith("pgsql", StringComparison.CurrentCultureIgnoreCase):
if (TypeName.StartsWith("Npgsql", StringComparison.OrdinalIgnoreCase) || TypeName.StartsWith("PgSql", StringComparison.OrdinalIgnoreCase))
return Singleton<PostgreSQLDatabaseType>.Instance;
case string t when t.StartsWith("oracle", StringComparison.CurrentCultureIgnoreCase):
if (TypeName.StartsWith("Oracle", StringComparison.OrdinalIgnoreCase))
return Singleton<OracleDatabaseType>.Instance;
case string t when t.StartsWith("sqlite", StringComparison.CurrentCultureIgnoreCase):
if (TypeName.StartsWith("SQLite", StringComparison.OrdinalIgnoreCase))
return Singleton<SQLiteDatabaseType>.Instance;
case string t when t.StartsWith("system.data.sqlclient.", StringComparison.CurrentCultureIgnoreCase):
if (TypeName.StartsWith("System.Data.SqlClient.", StringComparison.OrdinalIgnoreCase))
return Singleton<SqlServerDatabaseType>.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<MySqlDatabaseType>.Instance;
case string t when t.StartsWith("sqlserverce", StringComparison.CurrentCultureIgnoreCase):
if (ProviderName.IndexOf("SqlServerCe", StringComparison.OrdinalIgnoreCase) >= 0)
return Singleton<SqlServerCEDatabaseType>.Instance;
case string t when t.StartsWith("pgsql", StringComparison.CurrentCultureIgnoreCase):
if (ProviderName.IndexOf("pgsql", StringComparison.OrdinalIgnoreCase) >= 0)
return Singleton<PostgreSQLDatabaseType>.Instance;
case string t when t.StartsWith("oracle", StringComparison.CurrentCultureIgnoreCase):
if (ProviderName.IndexOf("Oracle", StringComparison.OrdinalIgnoreCase) >= 0)
return Singleton<OracleDatabaseType>.Instance;
case string t when t.StartsWith("sqlite", StringComparison.CurrentCultureIgnoreCase):
if (ProviderName.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) >= 0)
return Singleton<SQLiteDatabaseType>.Instance;
// Assume SQL Server
default:
return Singleton<SqlServerDatabaseType>.Instance;
}

// Assume SQL Server
return Singleton<SqlServerDatabaseType>.Instance;
}

}
}

0 comments on commit 14caa45

Please sign in to comment.