diff --git a/.nuget/nuget.exe b/.nuget/nuget.exe index 13dbd7b59..8db00e237 100644 Binary files a/.nuget/nuget.exe and b/.nuget/nuget.exe differ diff --git a/src/GUI/RevEng.Core.60/ReverseEngineerScaffolder.cs b/src/GUI/RevEng.Core.60/ReverseEngineerScaffolder.cs index 67566a630..5165ed1e4 100644 --- a/src/GUI/RevEng.Core.60/ReverseEngineerScaffolder.cs +++ b/src/GUI/RevEng.Core.60/ReverseEngineerScaffolder.cs @@ -208,6 +208,7 @@ public SavedModelFiles GenerateStoredProcedures( UseSchemaFolders = options.UseSchemaFolders, UseAsyncCalls = options.UseAsyncCalls, UseSchemaNamespaces = options.UseSchemaNamespaces, + UseDecimalDataAnnotation = options.UseDecimalDataAnnotation, }; var procedureScaffoldedModel = procedureScaffolder.ScaffoldModel(procedureModel, procedureOptions, schemas, ref errors); diff --git a/src/GUI/RevEng.Core.60/Routines/SqlServerRoutineScaffolder.cs b/src/GUI/RevEng.Core.60/Routines/SqlServerRoutineScaffolder.cs index 7a93f7898..fea7a6aba 100644 --- a/src/GUI/RevEng.Core.60/Routines/SqlServerRoutineScaffolder.cs +++ b/src/GUI/RevEng.Core.60/Routines/SqlServerRoutineScaffolder.cs @@ -309,7 +309,7 @@ private string WriteResultClass(List resultElements, Module using (Sb.Indent()) { - GenerateClass(resultElements, name, options.NullableReferences); + GenerateClass(resultElements, name, options.NullableReferences, options.UseDecimalDataAnnotation); } Sb.AppendLine("}"); @@ -317,28 +317,35 @@ private string WriteResultClass(List resultElements, Module return Sb.ToString(); } - private void GenerateClass(List resultElements, string name, bool nullableReferences) + private void GenerateClass(List resultElements, string name, bool nullableReferences, bool useDecimalDataAnnotation) { Sb.AppendLine($"public partial class {name}"); Sb.AppendLine("{"); using (Sb.Indent()) { - GenerateProperties(resultElements, nullableReferences); + GenerateProperties(resultElements, nullableReferences, useDecimalDataAnnotation); } Sb.AppendLine("}"); } - private void GenerateProperties(List resultElements, bool nullableReferences) + private void GenerateProperties(List resultElements, bool nullableReferences, bool useDecimalDataAnnotation) { foreach (var property in resultElements.OrderBy(e => e.Ordinal)) { var propertyNames = GeneratePropertyName(property.Name); - if (!string.IsNullOrEmpty(propertyNames.Item2)) + if (property.StoreType == "decimal" && useDecimalDataAnnotation) { - Sb.AppendLine(propertyNames.Item2); + Sb.AppendLine($"[Column(\"{property.Name}\", TypeName = \"{property.StoreType}({property.Precision},{property.Scale})\")]"); + } + else + { + if (!string.IsNullOrEmpty(propertyNames.Item2)) + { + Sb.AppendLine(propertyNames.Item2); + } } var propertyType = property.ClrType(); diff --git a/src/GUI/RevEng.Core.Abstractions/ModuleScaffolderOptions.cs b/src/GUI/RevEng.Core.Abstractions/ModuleScaffolderOptions.cs index 363b39812..ba1b4b10b 100644 --- a/src/GUI/RevEng.Core.Abstractions/ModuleScaffolderOptions.cs +++ b/src/GUI/RevEng.Core.Abstractions/ModuleScaffolderOptions.cs @@ -12,5 +12,6 @@ public class ModuleScaffolderOptions public virtual bool UseSchemaFolders { get; set; } public virtual bool UseAsyncCalls { get; set; } public virtual bool UseSchemaNamespaces { get; set; } + public virtual bool UseDecimalDataAnnotation { get; set; } } } diff --git a/src/GUI/RevEng.Shared/Cli/CliConfigMapper.cs b/src/GUI/RevEng.Shared/Cli/CliConfigMapper.cs index 6a1b1ebc8..d4ffea234 100644 --- a/src/GUI/RevEng.Shared/Cli/CliConfigMapper.cs +++ b/src/GUI/RevEng.Shared/Cli/CliConfigMapper.cs @@ -80,6 +80,7 @@ public static ReverseEngineerCommandOptions ToOptions(this CliConfig config, str UseNullableReferences = config.CodeGeneration.UseNullableReferenceTypes, ProjectRootNamespace = names.RootNamespace, MergeDacpacs = config.CodeGeneration.MergeDacpacs, + UseDecimalDataAnnotation = config.CodeGeneration.UseDecimalDataAnnotation, // Not supported: UseHandleBars = false, diff --git a/src/GUI/RevEng.Shared/Cli/Configuration/CodeGeneration.cs b/src/GUI/RevEng.Shared/Cli/Configuration/CodeGeneration.cs index 515d1b06b..6c297ed98 100644 --- a/src/GUI/RevEng.Shared/Cli/Configuration/CodeGeneration.cs +++ b/src/GUI/RevEng.Shared/Cli/Configuration/CodeGeneration.cs @@ -53,5 +53,8 @@ public class CodeGeneration [JsonPropertyName("merge-dacpacs")] public bool MergeDacpacs { get; set; } + + [JsonPropertyName("use-decimal-data-annotation-for-sproc-results")] + public bool UseDecimalDataAnnotation { get; set; } = true; } } diff --git a/src/GUI/RevEng.Shared/Cli/VsCode/Input.cs b/src/GUI/RevEng.Shared/Cli/VsCode/InputItem.cs similarity index 86% rename from src/GUI/RevEng.Shared/Cli/VsCode/Input.cs rename to src/GUI/RevEng.Shared/Cli/VsCode/InputItem.cs index 5b7ab118c..b9ac09c06 100644 --- a/src/GUI/RevEng.Shared/Cli/VsCode/Input.cs +++ b/src/GUI/RevEng.Shared/Cli/VsCode/InputItem.cs @@ -1,6 +1,6 @@ namespace RevEng.Common.Cli.VsCode { - public class Input + internal sealed class InputItem { public string type { get; set; } public string id { get; set; } diff --git a/src/GUI/RevEng.Shared/Cli/VsCode/Presentation.cs b/src/GUI/RevEng.Shared/Cli/VsCode/Presentation.cs index e904366db..bda76a3b5 100644 --- a/src/GUI/RevEng.Shared/Cli/VsCode/Presentation.cs +++ b/src/GUI/RevEng.Shared/Cli/VsCode/Presentation.cs @@ -1,6 +1,6 @@ namespace RevEng.Common.Cli.VsCode { - public class Presentation + internal sealed class Presentation { public string reveal { get; set; } } diff --git a/src/GUI/RevEng.Shared/Cli/VsCode/TaskItem.cs b/src/GUI/RevEng.Shared/Cli/VsCode/TaskItem.cs index dfd085d6e..ea90a9ef1 100644 --- a/src/GUI/RevEng.Shared/Cli/VsCode/TaskItem.cs +++ b/src/GUI/RevEng.Shared/Cli/VsCode/TaskItem.cs @@ -2,7 +2,7 @@ namespace RevEng.Common.Cli.VsCode { - internal class TaskItem + internal sealed class TaskItem { public string label { get; set; } public string command { get; set; } diff --git a/src/GUI/RevEng.Shared/Cli/VsCode/VsCodeTask.cs b/src/GUI/RevEng.Shared/Cli/VsCode/VsCodeTask.cs index f46b6c862..630a73d52 100644 --- a/src/GUI/RevEng.Shared/Cli/VsCode/VsCodeTask.cs +++ b/src/GUI/RevEng.Shared/Cli/VsCode/VsCodeTask.cs @@ -2,10 +2,10 @@ namespace RevEng.Common.Cli.VsCode { - internal class VsCodeTask + internal sealed class VsCodeTask { public string version { get; set; } public List tasks { get; set; } - public List inputs { get; set; } + public List inputs { get; set; } } } diff --git a/src/GUI/RevEng.Shared/Cli/VsCode/VsCodeTaskHelper.cs b/src/GUI/RevEng.Shared/Cli/VsCode/VsCodeTaskHelper.cs index 784feba9f..5e94884e2 100644 --- a/src/GUI/RevEng.Shared/Cli/VsCode/VsCodeTaskHelper.cs +++ b/src/GUI/RevEng.Shared/Cli/VsCode/VsCodeTaskHelper.cs @@ -83,9 +83,9 @@ public static void GenerateTaskPayload(string projectPath, int version, string r problemMatcher = "$msCompile", }, }, - inputs = new System.Collections.Generic.List + inputs = new System.Collections.Generic.List { - new Input + new InputItem { type = "promptString", id = "connection", diff --git a/src/GUI/RevEng.Shared/ReverseEngineerCommandOptions.cs b/src/GUI/RevEng.Shared/ReverseEngineerCommandOptions.cs index c2e895f88..68603b88d 100644 --- a/src/GUI/RevEng.Shared/ReverseEngineerCommandOptions.cs +++ b/src/GUI/RevEng.Shared/ReverseEngineerCommandOptions.cs @@ -56,6 +56,7 @@ public class ReverseEngineerCommandOptions public bool MergeDacpacs { get; set; } public bool UseLegacyResultSetDiscovery { get; set; } public bool UseAsyncCalls { get; set; } + public bool UseDecimalDataAnnotation { get; set; } public bool PreserveCasingWithRegex { get; set; } public bool UseDateOnlyTimeOnly { get; set; } } diff --git a/src/GUI/Shared/Handlers/ReverseEngineer/EfRevEngLauncher.cs b/src/GUI/Shared/Handlers/ReverseEngineer/EfRevEngLauncher.cs index d98b2d55d..ce8a8ebc9 100644 --- a/src/GUI/Shared/Handlers/ReverseEngineer/EfRevEngLauncher.cs +++ b/src/GUI/Shared/Handlers/ReverseEngineer/EfRevEngLauncher.cs @@ -114,6 +114,7 @@ public static async Task LaunchExternalRunnerAsync(Revers PreserveCasingWithRegex = options.PreserveCasingWithRegex, UseDateOnlyTimeOnly = options.UseDateOnlyTimeOnly, UseSchemaNamespaces = options.UseSchemaNamespaces, + UseDecimalDataAnnotation = options.UseDecimalDataAnnotationForSprocResult, }; var launcher = new EfRevEngLauncher(commandOptions, codeGenerationMode); diff --git a/src/GUI/Shared/Handlers/ReverseEngineer/ReverseEngineerOptions.cs b/src/GUI/Shared/Handlers/ReverseEngineer/ReverseEngineerOptions.cs index 117bfedd6..b39545625 100644 --- a/src/GUI/Shared/Handlers/ReverseEngineer/ReverseEngineerOptions.cs +++ b/src/GUI/Shared/Handlers/ReverseEngineer/ReverseEngineerOptions.cs @@ -59,5 +59,6 @@ public class ReverseEngineerOptions public bool PreserveCasingWithRegex { get; set; } = true; public bool UseDateOnlyTimeOnly { get; set; } public string T4TemplatePath { get; set; } + public bool UseDecimalDataAnnotationForSprocResult { get; set; } = true; } } diff --git a/src/GUI/lib/efreveng60.exe.zip b/src/GUI/lib/efreveng60.exe.zip index 00ea3fc65..c7af57fe4 100644 Binary files a/src/GUI/lib/efreveng60.exe.zip and b/src/GUI/lib/efreveng60.exe.zip differ diff --git a/src/GUI/lib/efreveng70.exe.zip b/src/GUI/lib/efreveng70.exe.zip index 78e8529dd..d7d89c2ae 100644 Binary files a/src/GUI/lib/efreveng70.exe.zip and b/src/GUI/lib/efreveng70.exe.zip differ diff --git a/src/GUI/lib/efreveng80.exe.zip b/src/GUI/lib/efreveng80.exe.zip index bcadd55b2..92cbaa776 100644 Binary files a/src/GUI/lib/efreveng80.exe.zip and b/src/GUI/lib/efreveng80.exe.zip differ