diff --git a/src/GUI/EFCorePowerTools.sln b/src/GUI/EFCorePowerTools.sln index d14abb8a8..53ef30dca 100644 --- a/src/GUI/EFCorePowerTools.sln +++ b/src/GUI/EFCorePowerTools.sln @@ -66,6 +66,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ErikEJ.EntityFrameworkCore. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DacFxStrongTypedCore.161", "DacFxStrongTypedCore.161\DacFxStrongTypedCore.161.csproj", "{F5032B12-DBC7-4B98-8324-C357A2C8CCE2}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RevEng.Core.80", "RevEng.Core.80\RevEng.Core.80.csproj", "{DFA5B4A2-0771-436E-B111-4CE3821D2697}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "efreveng80", "efreveng80\efreveng80.csproj", "{50EA6A90-2AF3-4A5D-A374-B83BEBDBF7C2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -352,6 +356,30 @@ Global {F5032B12-DBC7-4B98-8324-C357A2C8CCE2}.Release|arm64.Build.0 = Release|Any CPU {F5032B12-DBC7-4B98-8324-C357A2C8CCE2}.Release|x86.ActiveCfg = Release|Any CPU {F5032B12-DBC7-4B98-8324-C357A2C8CCE2}.Release|x86.Build.0 = Release|Any CPU + {DFA5B4A2-0771-436E-B111-4CE3821D2697}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DFA5B4A2-0771-436E-B111-4CE3821D2697}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DFA5B4A2-0771-436E-B111-4CE3821D2697}.Debug|arm64.ActiveCfg = Debug|Any CPU + {DFA5B4A2-0771-436E-B111-4CE3821D2697}.Debug|arm64.Build.0 = Debug|Any CPU + {DFA5B4A2-0771-436E-B111-4CE3821D2697}.Debug|x86.ActiveCfg = Debug|Any CPU + {DFA5B4A2-0771-436E-B111-4CE3821D2697}.Debug|x86.Build.0 = Debug|Any CPU + {DFA5B4A2-0771-436E-B111-4CE3821D2697}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DFA5B4A2-0771-436E-B111-4CE3821D2697}.Release|Any CPU.Build.0 = Release|Any CPU + {DFA5B4A2-0771-436E-B111-4CE3821D2697}.Release|arm64.ActiveCfg = Release|Any CPU + {DFA5B4A2-0771-436E-B111-4CE3821D2697}.Release|arm64.Build.0 = Release|Any CPU + {DFA5B4A2-0771-436E-B111-4CE3821D2697}.Release|x86.ActiveCfg = Release|Any CPU + {DFA5B4A2-0771-436E-B111-4CE3821D2697}.Release|x86.Build.0 = Release|Any CPU + {50EA6A90-2AF3-4A5D-A374-B83BEBDBF7C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {50EA6A90-2AF3-4A5D-A374-B83BEBDBF7C2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {50EA6A90-2AF3-4A5D-A374-B83BEBDBF7C2}.Debug|arm64.ActiveCfg = Debug|Any CPU + {50EA6A90-2AF3-4A5D-A374-B83BEBDBF7C2}.Debug|arm64.Build.0 = Debug|Any CPU + {50EA6A90-2AF3-4A5D-A374-B83BEBDBF7C2}.Debug|x86.ActiveCfg = Debug|Any CPU + {50EA6A90-2AF3-4A5D-A374-B83BEBDBF7C2}.Debug|x86.Build.0 = Debug|Any CPU + {50EA6A90-2AF3-4A5D-A374-B83BEBDBF7C2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {50EA6A90-2AF3-4A5D-A374-B83BEBDBF7C2}.Release|Any CPU.Build.0 = Release|Any CPU + {50EA6A90-2AF3-4A5D-A374-B83BEBDBF7C2}.Release|arm64.ActiveCfg = Release|Any CPU + {50EA6A90-2AF3-4A5D-A374-B83BEBDBF7C2}.Release|arm64.Build.0 = Release|Any CPU + {50EA6A90-2AF3-4A5D-A374-B83BEBDBF7C2}.Release|x86.ActiveCfg = Release|Any CPU + {50EA6A90-2AF3-4A5D-A374-B83BEBDBF7C2}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -377,6 +405,8 @@ Global {64EF1EE1-CA06-4218-80A1-E33931119DDF} = {F33E4994-452C-4C09-9FB5-C2E17D0884B6} {198C02B0-2665-4151-A051-D685CA0D09E8} = {8B7992B9-F570-4E74-8AE4-F9436BD7CBEF} {F5032B12-DBC7-4B98-8324-C357A2C8CCE2} = {F33E4994-452C-4C09-9FB5-C2E17D0884B6} + {DFA5B4A2-0771-436E-B111-4CE3821D2697} = {F33E4994-452C-4C09-9FB5-C2E17D0884B6} + {50EA6A90-2AF3-4A5D-A374-B83BEBDBF7C2} = {F33E4994-452C-4C09-9FB5-C2E17D0884B6} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {BFF7B9CC-46C9-4547-9FA1-D17E2A89613C} diff --git a/src/GUI/EFCorePowerTools/EFCorePowerTools.csproj b/src/GUI/EFCorePowerTools/EFCorePowerTools.csproj index cb80599c9..44326a079 100644 --- a/src/GUI/EFCorePowerTools/EFCorePowerTools.csproj +++ b/src/GUI/EFCorePowerTools/EFCorePowerTools.csproj @@ -183,6 +183,10 @@ efpt70sc.exe.zip true + + efreveng80.exe.zip + true + true diff --git a/src/GUI/RevEng.Core.60/ColumnRemovingScaffoldingModelFactory.cs b/src/GUI/RevEng.Core.60/ColumnRemovingScaffoldingModelFactory.cs index 4d0075522..467fd648c 100644 --- a/src/GUI/RevEng.Core.60/ColumnRemovingScaffoldingModelFactory.cs +++ b/src/GUI/RevEng.Core.60/ColumnRemovingScaffoldingModelFactory.cs @@ -20,7 +20,7 @@ public class ColumnRemovingScaffoldingModelFactory : RelationalScaffoldingModelF private readonly DatabaseType databaseType; private readonly bool ignoreManyToMany; -#if !CORE70 +#if !CORE70 && !CORE80 public ColumnRemovingScaffoldingModelFactory([NotNull] IOperationReporter reporter, [NotNull] ICandidateNamingService candidateNamingService, [NotNull] IPluralizer pluralizer, [NotNull] ICSharpUtilities cSharpUtilities, [NotNull] IScaffoldingTypeMapper scaffoldingTypeMapper, [NotNull] LoggingDefinitions loggingDefinitions, [NotNull] IModelRuntimeInitializer modelRuntimeInitializer, List tables, DatabaseType databaseType, bool ignoreManyToMany) : base(reporter, candidateNamingService, pluralizer, cSharpUtilities, scaffoldingTypeMapper, loggingDefinitions, modelRuntimeInitializer) #else diff --git a/src/GUI/RevEng.Core.60/ConnectionStringResolver.cs b/src/GUI/RevEng.Core.60/ConnectionStringResolver.cs index 88cecedcf..6181a8ea1 100644 --- a/src/GUI/RevEng.Core.60/ConnectionStringResolver.cs +++ b/src/GUI/RevEng.Core.60/ConnectionStringResolver.cs @@ -2,13 +2,16 @@ using System.Collections.Generic; using System.Data.Common; using System.IO; -using FirebirdSql.Data.FirebirdClient; using Microsoft.Data.SqlClient; using Microsoft.Data.Sqlite; +using Npgsql; + +#if !CORE80 +using FirebirdSql.Data.FirebirdClient; using Microsoft.EntityFrameworkCore.Scaffolding.Metadata; using MySqlConnector; -using Npgsql; using Oracle.ManagedDataAccess.Client; +#endif namespace RevEng.Core { @@ -65,6 +68,7 @@ public IList ResolveAlias() // Ignore } +#if !CORE80 try { var a = new MySqlConnectionStringBuilder(connectionString); @@ -94,6 +98,7 @@ public IList ResolveAlias() { // Ignore } +#endif return aliases; } diff --git a/src/GUI/RevEng.Core.60/ReverseEngineerRunner.cs b/src/GUI/RevEng.Core.60/ReverseEngineerRunner.cs index a0a67e99e..e36ae2da8 100644 --- a/src/GUI/RevEng.Core.60/ReverseEngineerRunner.cs +++ b/src/GUI/RevEng.Core.60/ReverseEngineerRunner.cs @@ -88,7 +88,7 @@ public static ReverseEngineerResult GenerateFiles(ReverseEngineerCommandOptions { SavedModelFiles filePaths = scaffolder!.GenerateDbContext(options, schemas, outputContextDir, modelNamespace, contextNamespace, options.ProjectPath, options.OutputPath); -#if CORE70 +#if CORE70 || CORE80 if (options.UseT4) { foreach (var paths in GetAlternateCodeTemplatePaths(options.ProjectPath)) @@ -113,7 +113,7 @@ public static ReverseEngineerResult GenerateFiles(ReverseEngineerCommandOptions var index = dbContextLines.FindIndex(l => l.Contains(" OnModelCreatingPartial(modelBuilder);", StringComparison.Ordinal)); if (index != -1) { -#if CORE70 +#if CORE70 || CORE80 dbContextLines.Insert(index, " OnModelCreatingGeneratedProcedures(modelBuilder);"); #else dbContextLines.Insert(index, " OnModelCreatingGeneratedProcedures(modelBuilder);"); @@ -126,7 +126,7 @@ public static ReverseEngineerResult GenerateFiles(ReverseEngineerCommandOptions var index = dbContextLines.FindIndex(l => l.Contains(" OnModelCreatingPartial(modelBuilder);", StringComparison.Ordinal)); if (index != -1) { -#if CORE70 +#if CORE70 || CORE80 dbContextLines.Insert(index, " OnModelCreatingGeneratedFunctions(modelBuilder);"); #else dbContextLines.Insert(index, " OnModelCreatingGeneratedFunctions(modelBuilder);"); @@ -246,7 +246,7 @@ public static void RetryFileWrite(string path, string finalText) } } -#if CORE70 +#if CORE70 || CORE80 private static List<(string Path, string OutputPath)> GetAlternateCodeTemplatePaths(string projectPath) { var result = new List<(string Path, string OutputPath)>(); diff --git a/src/GUI/RevEng.Core.60/ReverseEngineerScaffolder.cs b/src/GUI/RevEng.Core.60/ReverseEngineerScaffolder.cs index 3c8773236..2220a5746 100644 --- a/src/GUI/RevEng.Core.60/ReverseEngineerScaffolder.cs +++ b/src/GUI/RevEng.Core.60/ReverseEngineerScaffolder.cs @@ -85,7 +85,7 @@ public SavedModelFiles GenerateDbContext( ConnectionString = options.ConnectionString, SuppressOnConfiguring = !options.IncludeConnectionString, UseNullableReferenceTypes = options.UseNullableReferences, -#if CORE70 +#if CORE70 || CORE80 ProjectDir = options.UseT4 ? (options.T4TemplatePath ?? projectPath) : null, #endif }; @@ -486,7 +486,7 @@ private ScaffoldedModel ScaffoldModel( { throw new InvalidOperationException($"No model from provider {factory.GetType().ShortDisplayName()}"); } -#if CORE70 +#if CORE70 || CORE80 var codeGenerator = ModelCodeGeneratorSelector.Select(codeOptions); #else var codeGenerator = ModelCodeGeneratorSelector.Select(codeOptions.Language); diff --git a/src/GUI/RevEng.Core.60/ServiceProviderBuilder.cs b/src/GUI/RevEng.Core.60/ServiceProviderBuilder.cs index f7f99dd24..d72a6608b 100644 --- a/src/GUI/RevEng.Core.60/ServiceProviderBuilder.cs +++ b/src/GUI/RevEng.Core.60/ServiceProviderBuilder.cs @@ -1,10 +1,8 @@ using System; using System.Collections.Generic; -using EntityFrameworkCore.Scaffolding.Handlebars; +using System.Linq; using ErikEJ.EntityFrameworkCore.SqlServer.Scaffolding; -using FirebirdSql.EntityFrameworkCore.Firebird.Design.Internal; using Humanizer.Inflections; -using Microsoft.Data.SqlClient; using Microsoft.EntityFrameworkCore.Design; using Microsoft.EntityFrameworkCore.Design.Internal; using Microsoft.EntityFrameworkCore.Diagnostics; @@ -12,15 +10,23 @@ using Microsoft.EntityFrameworkCore.Scaffolding; using Microsoft.EntityFrameworkCore.Scaffolding.Internal; using Microsoft.EntityFrameworkCore.Sqlite.Design.Internal; -using Microsoft.EntityFrameworkCore.SqlServer.Design; using Microsoft.EntityFrameworkCore.SqlServer.Design.Internal; +using Microsoft.EntityFrameworkCore.SqlServer.Infrastructure.Internal; +using Microsoft.EntityFrameworkCore.Storage; using Microsoft.Extensions.DependencyInjection; using Npgsql.EntityFrameworkCore.PostgreSQL.Design.Internal; -using Oracle.EntityFrameworkCore.Design.Internal; -using Pomelo.EntityFrameworkCore.MySql.Design.Internal; using RevEng.Common; using RevEng.Core.Procedures; + +#if !CORE80 +using EntityFrameworkCore.Scaffolding.Handlebars; +using FirebirdSql.EntityFrameworkCore.Firebird.Design.Internal; +using Microsoft.Data.SqlClient; +using Microsoft.EntityFrameworkCore.SqlServer.Design; +using Oracle.EntityFrameworkCore.Design.Internal; +using Pomelo.EntityFrameworkCore.MySql.Design.Internal; using SimplerSoftware.EntityFrameworkCore.SqlServer.NodaTime.Design; +#endif namespace RevEng.Core { @@ -33,6 +39,11 @@ public static IServiceCollection AddEfpt(this IServiceCollection serviceCollecti throw new ArgumentNullException(nameof(options)); } + if (serviceCollection == null) + { + throw new ArgumentNullException(nameof(serviceCollection)); + } + var reporter = new OperationReporter( new OperationReportHandler( m => errors.Add(m), @@ -62,6 +73,7 @@ public static IServiceCollection AddEfpt(this IServiceCollection serviceCollecti serviceCollection.AddSingleton(provider => new ReplacingCandidateNamingService(options.CustomReplacers, options.PreserveCasingWithRegex)); } +#if !CORE80 if (options.UseHandleBars) { serviceCollection.AddHandlebarsScaffolding(hbOptions => @@ -72,7 +84,7 @@ public static IServiceCollection AddEfpt(this IServiceCollection serviceCollecti serviceCollection.AddSingleton(provider => new CustomTemplateFileService(options.OptionsPath)); } - +#endif if (options.UseInflector || options.UseLegacyPluralizer) { if (options.UseLegacyPluralizer) @@ -99,7 +111,16 @@ public static IServiceCollection AddEfpt(this IServiceCollection serviceCollecti var provider = new SqlServerDesignTimeServices(); provider.ConfigureDesignTimeServices(serviceCollection); +#if !CORE80 serviceCollection.AddSingleton(); +#else + serviceCollection.AddSingleton( + provider => new RevEng.Core.SqlServerTypeMappingSource( + provider.GetService(), + provider.GetService(), + provider.GetService(), + options.UseDateOnlyTimeOnly)); +#endif serviceCollection.AddSqlServerStoredProcedureDesignTimeServices(); serviceCollection.AddSqlServerFunctionDesignTimeServices(); @@ -116,6 +137,7 @@ public static IServiceCollection AddEfpt(this IServiceCollection serviceCollecti hierachyId.ConfigureDesignTimeServices(serviceCollection); } +#if !CORE80 if (options.UseNodaTime) { var nodaTime = new SqlServerNodaTimeDesignTimeServices(); @@ -127,7 +149,7 @@ public static IServiceCollection AddEfpt(this IServiceCollection serviceCollecti var dateOnlyTimeOnly = new SqlServerDateOnlyTimeOnlyDesignTimeServices(); dateOnlyTimeOnly.ConfigureDesignTimeServices(serviceCollection); } - +#endif break; case DatabaseType.SQLServerDacpac: @@ -156,7 +178,7 @@ public static IServiceCollection AddEfpt(this IServiceCollection serviceCollecti var hierachyId = new SqlServerHierarchyIdDesignTimeServices(); hierachyId.ConfigureDesignTimeServices(serviceCollection); } - +#if !CORE80 if (options.UseNodaTime) { var nodaTime = new SqlServerNodaTimeDesignTimeServices(); @@ -168,7 +190,7 @@ public static IServiceCollection AddEfpt(this IServiceCollection serviceCollecti var dateOnlyTimeOnly = new SqlServerDateOnlyTimeOnlyDesignTimeServices(); dateOnlyTimeOnly.ConfigureDesignTimeServices(serviceCollection); } - +#endif break; case DatabaseType.Npgsql: @@ -189,6 +211,7 @@ public static IServiceCollection AddEfpt(this IServiceCollection serviceCollecti break; +#if !CORE80 case DatabaseType.Mysql: var mysqlProvider = new MySqlDesignTimeServices(); mysqlProvider.ConfigureDesignTimeServices(serviceCollection); @@ -210,17 +233,18 @@ public static IServiceCollection AddEfpt(this IServiceCollection serviceCollecti var firebirdProvider = new FbDesignTimeServices(); firebirdProvider.ConfigureDesignTimeServices(serviceCollection); break; - +#endif case DatabaseType.SQLite: var sqliteProvider = new SqliteDesignTimeServices(); sqliteProvider.ConfigureDesignTimeServices(serviceCollection); +#if !CORE80 if (options.UseNodaTime) { var nodaTime = new SqliteNodaTimeDesignTimeServices(); nodaTime.ConfigureDesignTimeServices(serviceCollection); } - +#endif break; default: diff --git a/src/GUI/RevEng.Core.60/SkuHelper.cs b/src/GUI/RevEng.Core.60/SkuHelper.cs index d57323505..f93c43179 100644 --- a/src/GUI/RevEng.Core.60/SkuHelper.cs +++ b/src/GUI/RevEng.Core.60/SkuHelper.cs @@ -49,10 +49,12 @@ compatibility_level As CompatibilityLevel #pragma warning restore CA2100 // Review SQL queries for security vulnerabilities } } +#pragma warning disable CA1031 // Do not catch general exception types catch { // Ignore } +#pragma warning restore CA1031 // Do not catch general exception types break; case DatabaseType.SQLite: diff --git a/src/GUI/RevEng.Core.80/RevEng.Core.80.csproj b/src/GUI/RevEng.Core.80/RevEng.Core.80.csproj new file mode 100644 index 000000000..2d5b6f153 --- /dev/null +++ b/src/GUI/RevEng.Core.80/RevEng.Core.80.csproj @@ -0,0 +1,57 @@ + + + + net6.0 + $(NoWarn);EF1001 + RevEng.Core + warnings + + + + TRACE;CORE60;CORE80 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/GUI/RevEng.Core.80/SqlServerTypeMappingSource.cs b/src/GUI/RevEng.Core.80/SqlServerTypeMappingSource.cs new file mode 100644 index 000000000..5afd5cfca --- /dev/null +++ b/src/GUI/RevEng.Core.80/SqlServerTypeMappingSource.cs @@ -0,0 +1,34 @@ +using System; +using System.Data; +using Microsoft.EntityFrameworkCore.SqlServer.Infrastructure.Internal; +using Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal; +using Microsoft.EntityFrameworkCore.Storage; + +namespace RevEng.Core +{ + public class SqlServerTypeMappingSource : Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerTypeMappingSource + { + private readonly bool useDateOnlyTimeOnly; + + public SqlServerTypeMappingSource(TypeMappingSourceDependencies dependencies, RelationalTypeMappingSourceDependencies relationalDependencies, ISqlServerSingletonOptions singletonOptions, bool useDateOnlyTimeOnly) + : base(dependencies, relationalDependencies, singletonOptions) + { + this.useDateOnlyTimeOnly = useDateOnlyTimeOnly; + } + + protected override RelationalTypeMapping FindMapping(in RelationalTypeMappingInfo mappingInfo) + { + if (!useDateOnlyTimeOnly && (mappingInfo.ClrType == typeof(DateOnly))) + { + return new SqlServerDateTimeTypeMapping("date", DbType.Date); + } + + if (!useDateOnlyTimeOnly && (mappingInfo.ClrType == typeof(TimeOnly))) + { + return new SqlServerTimeSpanTypeMapping("time"); + } + + return base.FindMapping(mappingInfo); + } + } +} diff --git a/src/GUI/RevEng.Shared/CodeGenerationMode.cs b/src/GUI/RevEng.Shared/CodeGenerationMode.cs index 365257f7f..6bb620bc1 100644 --- a/src/GUI/RevEng.Shared/CodeGenerationMode.cs +++ b/src/GUI/RevEng.Shared/CodeGenerationMode.cs @@ -9,5 +9,6 @@ public enum CodeGenerationMode // Do not re-use 0 or 1! EFCore6 = 2, EFCore7 = 3, + EFCore8 = 4, } } diff --git a/src/GUI/Shared/Handlers/ReverseEngineer/EfRevEngLauncher.cs b/src/GUI/Shared/Handlers/ReverseEngineer/EfRevEngLauncher.cs index 971e84a19..0463b19ba 100644 --- a/src/GUI/Shared/Handlers/ReverseEngineer/EfRevEngLauncher.cs +++ b/src/GUI/Shared/Handlers/ReverseEngineer/EfRevEngLauncher.cs @@ -19,6 +19,8 @@ public class EfRevEngLauncher private readonly CodeGenerationMode codeGenerationMode; private readonly string revengFolder; private readonly string revengRoot; + private readonly string exeName; + private readonly string zipName; private readonly ResultDeserializer resultDeserializer; public EfRevEngLauncher(ReverseEngineerCommandOptions options, CodeGenerationMode codeGenerationMode) @@ -27,18 +29,30 @@ public EfRevEngLauncher(ReverseEngineerCommandOptions options, CodeGenerationMod this.codeGenerationMode = codeGenerationMode; var versionSuffix = FileVersionInfo.GetVersionInfo(typeof(EFCorePowerToolsPackage).Assembly.Location).FileVersion; + string revengVersion; + switch (codeGenerationMode) { case CodeGenerationMode.EFCore6: - revengFolder = "efreveng6."; + revengVersion = "6"; break; + case CodeGenerationMode.EFCore7: - revengFolder = "efreveng7."; + revengVersion = "7"; + break; + + case CodeGenerationMode.EFCore8: + revengVersion = "8"; break; + default: - throw new NotSupportedException(); + throw new NotSupportedException("Unsupported code generation mode"); } + revengFolder = $"efreveng{revengVersion}."; + exeName = $"efreveng{revengVersion}0.dll"; + zipName = $"efreveng{revengVersion}0.exe.zip"; + revengRoot = revengFolder; revengFolder += versionSuffix; @@ -184,10 +198,11 @@ private async Task> GetTablesInternalAsync(string arguments) private async Task CreateStartInfoAsync(string arguments) { - string version = "3.1"; + string version = "6.0"; - if (codeGenerationMode == CodeGenerationMode.EFCore6 || codeGenerationMode == CodeGenerationMode.EFCore7) + if (codeGenerationMode == CodeGenerationMode.EFCore8) { + // TODO Target .NET 8.0 soon version = "6.0"; } @@ -261,7 +276,7 @@ private string DropNetCoreFiles() Debug.Assert(fromDir != null, nameof(fromDir) + " != null"); Debug.Assert(toDir != null, nameof(toDir) + " != null"); - var fullPath = Path.Combine(toDir, GetExeName()); + var fullPath = Path.Combine(toDir, exeName); if (Directory.Exists(toDir) && File.Exists(fullPath) @@ -277,20 +292,6 @@ private string DropNetCoreFiles() Directory.CreateDirectory(toDir); - string zipName; - - switch (codeGenerationMode) - { - case CodeGenerationMode.EFCore6: - zipName = $"efreveng60.exe.zip"; - break; - case CodeGenerationMode.EFCore7: - zipName = $"efreveng70.exe.zip"; - break; - default: - throw new NotSupportedException(); - } - using (var archive = ZipFile.Open(Path.Combine(fromDir, zipName), ZipArchiveMode.Read)) { archive.ExtractToDirectory(toDir, true); @@ -320,18 +321,5 @@ private string DropNetCoreFiles() return fullPath; } - - private string GetExeName() - { - switch (codeGenerationMode) - { - case CodeGenerationMode.EFCore6: - return "efreveng60.dll"; - case CodeGenerationMode.EFCore7: - return "efreveng70.dll"; - default: - throw new NotSupportedException("Unsupported code generation mode"); - } - } } } diff --git a/src/GUI/Shared/Helpers/ReverseEngineerHelper.cs b/src/GUI/Shared/Helpers/ReverseEngineerHelper.cs index 171e25cc1..03d16ef41 100644 --- a/src/GUI/Shared/Helpers/ReverseEngineerHelper.cs +++ b/src/GUI/Shared/Helpers/ReverseEngineerHelper.cs @@ -159,6 +159,7 @@ public string DropTemplates(string optionsPath, string projectPath, CodeGenerati { list.Add(new CodeGenerationItem { Key = (int)CodeGenerationMode.EFCore7, Value = "EF Core 7" }); list.Add(new CodeGenerationItem { Key = (int)CodeGenerationMode.EFCore6, Value = "EF Core 6" }); + list.Add(new CodeGenerationItem { Key = (int)CodeGenerationMode.EFCore8, Value = "EF Core 8 (preview)" }); } if (!list.Any()) diff --git a/src/GUI/efreveng80/BuildCmdlineTool.cmd b/src/GUI/efreveng80/BuildCmdlineTool.cmd new file mode 100644 index 000000000..443b2aa30 --- /dev/null +++ b/src/GUI/efreveng80/BuildCmdlineTool.cmd @@ -0,0 +1,27 @@ + +dotnet publish -o bin\Release\net6.0\x64\publish -f net6.0 -r win-x64 -c Release --no-self-contained + +if %errorlevel% equ 1 goto notbuilt + +del bin\Release\net6.0\x64\publish\DacFxStrongTypedCore.161.dll +del bin\Release\net6.0\x64\publish\DacFxStrongTypedCore.161.pdb +del bin\Release\net6.0\x64\publish\Microsoft.Data.Tools.Schema.Sql.dll +del bin\Release\net6.0\x64\publish\Microsoft.Data.Tools.Schema.Tasks.Sql.dll +del bin\Release\net6.0\x64\publish\Microsoft.Data.Tools.Sql.DesignServices.dll +del bin\Release\net6.0\x64\publish\Microsoft.Data.Tools.Utilities.dll +del bin\Release\net6.0\x64\publish\Microsoft.SqlServer.Dac.dll +del bin\Release\net6.0\x64\publish\Microsoft.SqlServer.Dac.Extensions.dll +del bin\Release\net6.0\x64\publish\Microsoft.SqlServer.Server.dll +del bin\Release\net6.0\x64\publish\Microsoft.SqlServer.TransactSql.ScriptDom.dll + +"C:\Program Files\7-Zip\7z.exe" -mm=Deflate -mfb=258 -mpass=15 a efreveng80.exe.zip .\bin\Release\net6.0\x64\publish\* + +move /Y efreveng80.exe.zip ..\lib\ + +goto end + +:notbuilt +echo Build error + +:end +pause diff --git a/src/GUI/efreveng80/efreveng80.csproj b/src/GUI/efreveng80/efreveng80.csproj new file mode 100644 index 000000000..46c900484 --- /dev/null +++ b/src/GUI/efreveng80/efreveng80.csproj @@ -0,0 +1,23 @@ + + + + Exe + net6.0 + en-US + 2.5.0 + + + + + + + + + + + + + + + + diff --git a/src/GUI/lib/efreveng80.exe.zip b/src/GUI/lib/efreveng80.exe.zip new file mode 100644 index 000000000..5f6eed42f Binary files /dev/null and b/src/GUI/lib/efreveng80.exe.zip differ