diff --git a/src/Core/RevEng.Core.80/ConnectionStringResolver.cs b/src/Core/RevEng.Core.80/ConnectionStringResolver.cs index 4ac535eb7..663e431c0 100644 --- a/src/Core/RevEng.Core.80/ConnectionStringResolver.cs +++ b/src/Core/RevEng.Core.80/ConnectionStringResolver.cs @@ -5,11 +5,10 @@ using Microsoft.Data.SqlClient; using Microsoft.Data.Sqlite; using Npgsql; - +using Oracle.ManagedDataAccess.Client; #if !CORE90 using FirebirdSql.Data.FirebirdClient; using MySqlConnector; -using Oracle.ManagedDataAccess.Client; #endif namespace RevEng.Core @@ -67,21 +66,20 @@ public IList ResolveAlias() // Ignore } -#if !CORE90 try { - var a = new MySqlConnectionStringBuilder(connectionString); - aliases.Add("mysql"); + var a = new OracleConnectionStringBuilder(connectionString); + aliases.Add("oracle"); } catch { // Ignore } - +#if !CORE90 try { - var a = new OracleConnectionStringBuilder(connectionString); - aliases.Add("oracle"); + var a = new MySqlConnectionStringBuilder(connectionString); + aliases.Add("mysql"); } catch { @@ -98,7 +96,6 @@ public IList ResolveAlias() // Ignore } #endif - return aliases; } diff --git a/src/Core/RevEng.Core.80/DataverseModelFactoryExtension.cs b/src/Core/RevEng.Core.80/DataverseModelFactoryExtension.cs index 216d8a299..a467c45ce 100644 --- a/src/Core/RevEng.Core.80/DataverseModelFactoryExtension.cs +++ b/src/Core/RevEng.Core.80/DataverseModelFactoryExtension.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Data.Common; using System.Linq; -using System.Text; using System.Threading.Tasks; using Microsoft.Data.SqlClient; using Microsoft.EntityFrameworkCore.Scaffolding.Metadata; diff --git a/src/Core/RevEng.Core.80/PatchedSqlServerDatabaseModelFactory.cs b/src/Core/RevEng.Core.80/PatchedSqlServerDatabaseModelFactory.cs index 0299ea040..9c75914e8 100644 --- a/src/Core/RevEng.Core.80/PatchedSqlServerDatabaseModelFactory.cs +++ b/src/Core/RevEng.Core.80/PatchedSqlServerDatabaseModelFactory.cs @@ -7,7 +7,6 @@ using System.Linq; using System.Text; using System.Text.RegularExpressions; -using System.Threading.Tasks; using Microsoft.Data.SqlClient; using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.EntityFrameworkCore.Metadata; @@ -19,10 +18,6 @@ using Microsoft.EntityFrameworkCore.SqlServer.Metadata.Internal; using Microsoft.EntityFrameworkCore.Storage; using Microsoft.Extensions.Logging; -using Microsoft.PowerPlatform.Dataverse.Client; -using Microsoft.Xrm.Sdk.Messages; -using Microsoft.Xrm.Sdk.Metadata; -using Microsoft.Xrm.Sdk.Metadata.Query; using RevEng.Common; using RevEng.Core; diff --git a/src/Core/RevEng.Core.80/RevEng.Core.80.csproj b/src/Core/RevEng.Core.80/RevEng.Core.80.csproj index 9355cd190..59c360a2f 100644 --- a/src/Core/RevEng.Core.80/RevEng.Core.80.csproj +++ b/src/Core/RevEng.Core.80/RevEng.Core.80.csproj @@ -14,6 +14,7 @@ + diff --git a/src/Core/RevEng.Core.80/ServiceProviderBuilder.cs b/src/Core/RevEng.Core.80/ServiceProviderBuilder.cs index 191cbe725..9620f14bf 100644 --- a/src/Core/RevEng.Core.80/ServiceProviderBuilder.cs +++ b/src/Core/RevEng.Core.80/ServiceProviderBuilder.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; #if !CORE90 +using EFCore.Snowflake.Design.Internal; using FirebirdSql.EntityFrameworkCore.Firebird.Design.Internal; #endif using EntityFrameworkCore.Scaffolding.Handlebars; @@ -131,6 +132,11 @@ public static IServiceCollection AddEfpt(this IServiceCollection serviceCollecti var firebirdProvider = new FbDesignTimeServices(); firebirdProvider.ConfigureDesignTimeServices(serviceCollection); break; + + case DatabaseType.Snowflake: + var snowflakeProvider = new SnowflakeDesignTimeServices(); + snowflakeProvider.ConfigureDesignTimeServices(serviceCollection); + break; #endif case DatabaseType.SQLite: var sqliteProvider = new SqliteDesignTimeServices(); diff --git a/src/Core/RevEng.Core.90/RevEng.Core.90.csproj b/src/Core/RevEng.Core.90/RevEng.Core.90.csproj index 269f343d9..f38046d83 100644 --- a/src/Core/RevEng.Core.90/RevEng.Core.90.csproj +++ b/src/Core/RevEng.Core.90/RevEng.Core.90.csproj @@ -27,6 +27,7 @@ + diff --git a/src/Core/efcpt.8/Options/ScaffoldOptions.cs b/src/Core/efcpt.8/Options/ScaffoldOptions.cs index 71db27402..995936d78 100644 --- a/src/Core/efcpt.8/Options/ScaffoldOptions.cs +++ b/src/Core/efcpt.8/Options/ScaffoldOptions.cs @@ -17,7 +17,7 @@ internal sealed class ScaffoldOptions [Value( 1, MetaName = "provider", - HelpText = "Name of EF Core provider, or use an abbreviation (mssql, postgres, sqlite, oracle, mysql, firebird). May not be required, as an attempt is made to resolve the provider from the connection string.")] + HelpText = "Name of EF Core provider, or use an abbreviation (mssql, postgres, sqlite, oracle, mysql, firebird, snowflake). May not be required, as an attempt is made to resolve the provider from the connection string.")] public string Provider { get; set; } [Option('o', "output", HelpText = "Root output folder, defaults to current directory")] diff --git a/src/GUI/EFCorePowerTools/Dialogs/ConnectionDialog.xaml b/src/GUI/EFCorePowerTools/Dialogs/ConnectionDialog.xaml index 169866048..fe21848bf 100644 --- a/src/GUI/EFCorePowerTools/Dialogs/ConnectionDialog.xaml +++ b/src/GUI/EFCorePowerTools/Dialogs/ConnectionDialog.xaml @@ -40,6 +40,7 @@ SelectedValue="{Binding DbType, Mode=TwoWay}" SelectedValuePath="Tag" Grid.Row="3" Margin="12,2" Width="136" HorizontalAlignment="Left" > MySQL + Snowflake diff --git a/src/GUI/EFCorePowerTools/Dialogs/ConnectionDialog.xaml.cs b/src/GUI/EFCorePowerTools/Dialogs/ConnectionDialog.xaml.cs index 0e6e97d48..d4b328e33 100644 --- a/src/GUI/EFCorePowerTools/Dialogs/ConnectionDialog.xaml.cs +++ b/src/GUI/EFCorePowerTools/Dialogs/ConnectionDialog.xaml.cs @@ -57,18 +57,13 @@ private void CmdDatabaseType_SelectionChanged(object sender, System.Windows.Cont switch (dbType) { - case DatabaseType.Undefined: - case DatabaseType.SQLite: - case DatabaseType.Npgsql: - case DatabaseType.Oracle: - case DatabaseType.SQLServerDacpac: - case DatabaseType.Firebird: - case DatabaseType.SQLServer: - break; - case DatabaseType.Mysql: txtSample.Text = "Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;"; break; + case DatabaseType.Snowflake: + txtSample.Text = "ACCOUNT=;DB=MYDATABASE;SCHEMA=MYSCHEMA;USER=MYUSERNAME;PASSWORD=myPassword"; + break; + default: break; } diff --git a/src/GUI/RevEng.Shared/DatabaseType.cs b/src/GUI/RevEng.Shared/DatabaseType.cs index 45eb87e59..eb94e49d7 100644 --- a/src/GUI/RevEng.Shared/DatabaseType.cs +++ b/src/GUI/RevEng.Shared/DatabaseType.cs @@ -11,5 +11,6 @@ public enum DatabaseType Oracle = 7, SQLServerDacpac = 8, Firebird = 10, + Snowflake = 11, } } diff --git a/src/GUI/RevEng.Shared/Providers.cs b/src/GUI/RevEng.Shared/Providers.cs index 401ac0b37..ee03494e1 100644 --- a/src/GUI/RevEng.Shared/Providers.cs +++ b/src/GUI/RevEng.Shared/Providers.cs @@ -41,6 +41,9 @@ public static DatabaseType ToDatabaseType(this string providerAlias, bool isDacp case "FirebirdSql.EntityFrameworkCore.Firebird": return DatabaseType.Firebird; + case "EFCore.Snowflake": + return DatabaseType.Snowflake; + default: return DatabaseType.Undefined; } @@ -443,6 +446,28 @@ public static List GetNeededPackages(DatabaseType databaseType, bo }); } + if (databaseType == DatabaseType.Snowflake) + { + var pkgVersion = string.Empty; + switch (codeGenerationMode) + { + case CodeGenerationMode.EFCore8: + pkgVersion = "8.0.8"; + break; + + default: throw new NotImplementedException(); + } + + packages.Add(new NuGetPackage + { + PackageId = "EFCore.Snowflake", + Version = pkgVersion, + DatabaseTypes = new List { databaseType }, + IsMainProviderPackage = true, + UseMethodName = "Snowflake", + }); + } + return packages; } @@ -519,6 +544,10 @@ private static Dictionary> GetProvidersWithAliases() "FirebirdSql.EntityFrameworkCore.Firebird", new List { "firebird" } }, + { + "EFCore.Snowflake", + new List { "snowflake" } + }, }; } } diff --git a/src/GUI/Shared/Helpers/ReverseEngineerHelper.cs b/src/GUI/Shared/Helpers/ReverseEngineerHelper.cs index 80642c347..4fd9fceda 100644 --- a/src/GUI/Shared/Helpers/ReverseEngineerHelper.cs +++ b/src/GUI/Shared/Helpers/ReverseEngineerHelper.cs @@ -305,6 +305,8 @@ private string GetProviderName(DatabaseType databaseType) return "SqlServer"; case DatabaseType.Firebird: return "Firebird"; + case DatabaseType.Snowflake: + return "Snowflake"; default: return "[ProviderName]"; } diff --git a/src/GUI/lib/efreveng80.exe.zip b/src/GUI/lib/efreveng80.exe.zip index ecf6ee7a0..42ab96701 100644 Binary files a/src/GUI/lib/efreveng80.exe.zip and b/src/GUI/lib/efreveng80.exe.zip differ