From 43adf32d6f27fbea5c3db759a72052635253e5e1 Mon Sep 17 00:00:00 2001 From: Joe Gallagher Date: Wed, 19 Nov 2025 13:37:52 -0500 Subject: [PATCH 1/7] add trim option --- src/Pingmint.CodeGen.Sql/Analyzer.cs | 2 ++ src/Pingmint.CodeGen.Sql/CodeFile.cs | 1 + src/Pingmint.CodeGen.Sql/Model/Databases.cs | 1 + src/Pingmint.CodeGen.Sql/Types.cs | 1 + src/Pingmint.CodeGen.Sql/Yaml/Serialization.cs | 1 + 5 files changed, 6 insertions(+) diff --git a/src/Pingmint.CodeGen.Sql/Analyzer.cs b/src/Pingmint.CodeGen.Sql/Analyzer.cs index 9209b27..77cdeb7 100644 --- a/src/Pingmint.CodeGen.Sql/Analyzer.cs +++ b/src/Pingmint.CodeGen.Sql/Analyzer.cs @@ -328,6 +328,7 @@ public async Task AnalyzeStatementAsync(String database, String name, String com var propertyType = isNullable ? csharpTypeInfo.TypeRefNullable : csharpTypeInfo.TypeRef; var propertyTypeWithoutNullable = csharpTypeInfo.TypeRef; var isValueType = csharpTypeInfo.IsValueType; + var sqlDbType = csharpTypeInfo.SqlDbType; var recordProperty = new RecordProperty { @@ -337,6 +338,7 @@ public async Task AnalyzeStatementAsync(String database, String name, String com FieldTypeIsValueType = isValueType, ColumnName = columnName, ColumnIsNullable = isNullable, + SqlDbType = sqlDbType, }; return recordProperty; } diff --git a/src/Pingmint.CodeGen.Sql/CodeFile.cs b/src/Pingmint.CodeGen.Sql/CodeFile.cs index 5751f6c..86c41d0 100644 --- a/src/Pingmint.CodeGen.Sql/CodeFile.cs +++ b/src/Pingmint.CodeGen.Sql/CodeFile.cs @@ -140,6 +140,7 @@ public String GenerateCode() int i = 1; foreach (var property in record.Properties) { + code.Line($"// {property}"); var fieldName = property.FieldName; var IsValueType = property.FieldTypeIsValueType; var ColumnIsNullable = property.ColumnIsNullable; diff --git a/src/Pingmint.CodeGen.Sql/Model/Databases.cs b/src/Pingmint.CodeGen.Sql/Model/Databases.cs index 03190e3..b20abde 100644 --- a/src/Pingmint.CodeGen.Sql/Model/Databases.cs +++ b/src/Pingmint.CodeGen.Sql/Model/Databases.cs @@ -41,6 +41,7 @@ public class SqlClient // mapping public String? Async { get; set; } + public Boolean? TrimChar { get; set; } // sequence } diff --git a/src/Pingmint.CodeGen.Sql/Types.cs b/src/Pingmint.CodeGen.Sql/Types.cs index d8aabae..9e49177 100644 --- a/src/Pingmint.CodeGen.Sql/Types.cs +++ b/src/Pingmint.CodeGen.Sql/Types.cs @@ -132,4 +132,5 @@ public class RecordProperty public bool FieldTypeIsValueType { get; internal set; } public bool ColumnIsNullable { get; internal set; } public short? MaxLength { get; init; } + public SqlDbType? SqlDbType { get; init; } } diff --git a/src/Pingmint.CodeGen.Sql/Yaml/Serialization.cs b/src/Pingmint.CodeGen.Sql/Yaml/Serialization.cs index ae5eed3..1f5229b 100644 --- a/src/Pingmint.CodeGen.Sql/Yaml/Serialization.cs +++ b/src/Pingmint.CodeGen.Sql/Yaml/Serialization.cs @@ -65,6 +65,7 @@ protected override bool Add(string key, string value) switch (key) { case "async": this.Model.Async = value; return true; + case "trimChar": this.Model.TrimChar = value?.ToUpperInvariant() == "TRUE"; return true; default: return false; } } From 30da25f124197bb1680b6cfffe2172ee0f46a049 Mon Sep 17 00:00:00 2001 From: Joe Gallagher Date: Wed, 19 Nov 2025 13:44:24 -0500 Subject: [PATCH 2/7] pass trim value --- src/Pingmint.CodeGen.Sql/CodeFile.cs | 6 +++++- src/Pingmint.CodeGen.Sql/Model/Databases.cs | 2 +- src/Pingmint.CodeGen.Sql/Pingmint.CodeGen.Sql.csproj | 4 ++-- src/Pingmint.CodeGen.Sql/Program.cs | 1 + src/Pingmint.CodeGen.Sql/Yaml/Serialization.cs | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Pingmint.CodeGen.Sql/CodeFile.cs b/src/Pingmint.CodeGen.Sql/CodeFile.cs index 86c41d0..7541624 100644 --- a/src/Pingmint.CodeGen.Sql/CodeFile.cs +++ b/src/Pingmint.CodeGen.Sql/CodeFile.cs @@ -29,6 +29,7 @@ public class CodeFile public String TypeKeyword { get; set; } = "record class"; public Boolean AllowAsync { get; set; } = true; + public Boolean TrimChar { get; set; } = false; public String GenerateCode() { @@ -140,7 +141,10 @@ public String GenerateCode() int i = 1; foreach (var property in record.Properties) { - code.Line($"// {property}"); + if (property.SqlDbType == SqlDbType.Char) + { + code.Line($"// {TrimChar} {property}"); + } var fieldName = property.FieldName; var IsValueType = property.FieldTypeIsValueType; var ColumnIsNullable = property.ColumnIsNullable; diff --git a/src/Pingmint.CodeGen.Sql/Model/Databases.cs b/src/Pingmint.CodeGen.Sql/Model/Databases.cs index b20abde..71bf4fd 100644 --- a/src/Pingmint.CodeGen.Sql/Model/Databases.cs +++ b/src/Pingmint.CodeGen.Sql/Model/Databases.cs @@ -41,7 +41,7 @@ public class SqlClient // mapping public String? Async { get; set; } - public Boolean? TrimChar { get; set; } + public String? TrimChar { get; set; } // sequence } diff --git a/src/Pingmint.CodeGen.Sql/Pingmint.CodeGen.Sql.csproj b/src/Pingmint.CodeGen.Sql/Pingmint.CodeGen.Sql.csproj index 191a1d4..32ede9d 100644 --- a/src/Pingmint.CodeGen.Sql/Pingmint.CodeGen.Sql.csproj +++ b/src/Pingmint.CodeGen.Sql/Pingmint.CodeGen.Sql.csproj @@ -1,9 +1,9 @@ - 0.46 + 0.47 Exe - net9.0 + net10.0 latest enable enable diff --git a/src/Pingmint.CodeGen.Sql/Program.cs b/src/Pingmint.CodeGen.Sql/Program.cs index 5d7da8a..5b46149 100644 --- a/src/Pingmint.CodeGen.Sql/Program.cs +++ b/src/Pingmint.CodeGen.Sql/Program.cs @@ -42,6 +42,7 @@ internal static async Task Main(string[] args) codeFile.ClassName = config.CSharp.ClassName; codeFile.TypeKeyword = config.CSharp.TypeKeyword; codeFile.AllowAsync = config?.SqlClient?.Async != "false"; + codeFile.TrimChar = config?.SqlClient?.TrimChar?.ToUpperInvariant() == "TRUE"; if (config?.Databases?.Items is { } databases) { diff --git a/src/Pingmint.CodeGen.Sql/Yaml/Serialization.cs b/src/Pingmint.CodeGen.Sql/Yaml/Serialization.cs index 1f5229b..8ba6108 100644 --- a/src/Pingmint.CodeGen.Sql/Yaml/Serialization.cs +++ b/src/Pingmint.CodeGen.Sql/Yaml/Serialization.cs @@ -65,7 +65,7 @@ protected override bool Add(string key, string value) switch (key) { case "async": this.Model.Async = value; return true; - case "trimChar": this.Model.TrimChar = value?.ToUpperInvariant() == "TRUE"; return true; + case "trimChar": this.Model.TrimChar = value; return true; default: return false; } } From 4891b6b355c9aa80e3f4f20f054953c93d2b2683 Mon Sep 17 00:00:00 2001 From: Joe Gallagher Date: Wed, 19 Nov 2025 13:50:38 -0500 Subject: [PATCH 3/7] trim col --- src/Pingmint.CodeGen.Sql/CodeFile.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Pingmint.CodeGen.Sql/CodeFile.cs b/src/Pingmint.CodeGen.Sql/CodeFile.cs index 7541624..fb26683 100644 --- a/src/Pingmint.CodeGen.Sql/CodeFile.cs +++ b/src/Pingmint.CodeGen.Sql/CodeFile.cs @@ -141,9 +141,14 @@ public String GenerateCode() int i = 1; foreach (var property in record.Properties) { - if (property.SqlDbType == SqlDbType.Char) + String trim = String.Empty; + if (TrimChar && property.SqlDbType == SqlDbType.Char) { - code.Line($"// {TrimChar} {property}"); + trim = ".Trim()"; + if (property.ColumnIsNullable) + { + trim = "?" + trim; + } } var fieldName = property.FieldName; var IsValueType = property.FieldTypeIsValueType; @@ -153,10 +158,10 @@ public String GenerateCode() var ordinalVarName = record.Properties.Count == 1 ? ordinalsArg : $"{ordinalsArg}.Item{i++}"; var line = (IsValueType, ColumnIsNullable) switch { - (false, true) => String.Format("{0} = OptionalClass<{2}>(reader, {1}),", fieldName, ordinalVarName, fieldTypeWithoutNullable), - (true, true) => String.Format("{0} = OptionalValue<{2}>(reader, {1}),", fieldName, ordinalVarName, fieldTypeWithoutNullable), - (false, false) => String.Format("{0} = RequiredClass<{2}>(reader, {1}),", fieldName, ordinalVarName, fieldTypeWithoutNullable), - (true, false) => String.Format("{0} = RequiredValue<{2}>(reader, {1}),", fieldName, ordinalVarName, fieldTypeWithoutNullable), + (false, true) => String.Format("{0} = OptionalClass<{2}>(reader, {1}){2},", fieldName, ordinalVarName, fieldTypeWithoutNullable, trim), + (true, true) => String.Format("{0} = OptionalValue<{2}>(reader, {1}){2},", fieldName, ordinalVarName, fieldTypeWithoutNullable, trim), + (false, false) => String.Format("{0} = RequiredClass<{2}>(reader, {1}){2},", fieldName, ordinalVarName, fieldTypeWithoutNullable, trim), + (true, false) => String.Format("{0} = RequiredValue<{2}>(reader, {1}){2},", fieldName, ordinalVarName, fieldTypeWithoutNullable, trim), }; code.Line(line); } From 6708f8825ff10d0e7ac53d431c0c5cf56f3ef169 Mon Sep 17 00:00:00 2001 From: Joe Gallagher Date: Wed, 19 Nov 2025 13:52:33 -0500 Subject: [PATCH 4/7] fix index --- src/Pingmint.CodeGen.Sql/CodeFile.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Pingmint.CodeGen.Sql/CodeFile.cs b/src/Pingmint.CodeGen.Sql/CodeFile.cs index fb26683..b674e45 100644 --- a/src/Pingmint.CodeGen.Sql/CodeFile.cs +++ b/src/Pingmint.CodeGen.Sql/CodeFile.cs @@ -158,10 +158,10 @@ public String GenerateCode() var ordinalVarName = record.Properties.Count == 1 ? ordinalsArg : $"{ordinalsArg}.Item{i++}"; var line = (IsValueType, ColumnIsNullable) switch { - (false, true) => String.Format("{0} = OptionalClass<{2}>(reader, {1}){2},", fieldName, ordinalVarName, fieldTypeWithoutNullable, trim), - (true, true) => String.Format("{0} = OptionalValue<{2}>(reader, {1}){2},", fieldName, ordinalVarName, fieldTypeWithoutNullable, trim), - (false, false) => String.Format("{0} = RequiredClass<{2}>(reader, {1}){2},", fieldName, ordinalVarName, fieldTypeWithoutNullable, trim), - (true, false) => String.Format("{0} = RequiredValue<{2}>(reader, {1}){2},", fieldName, ordinalVarName, fieldTypeWithoutNullable, trim), + (false, true) => String.Format("{0} = OptionalClass<{2}>(reader, {1}){3},", fieldName, ordinalVarName, fieldTypeWithoutNullable, trim), + (true, true) => String.Format("{0} = OptionalValue<{2}>(reader, {1}){3},", fieldName, ordinalVarName, fieldTypeWithoutNullable, trim), + (false, false) => String.Format("{0} = RequiredClass<{2}>(reader, {1}){3},", fieldName, ordinalVarName, fieldTypeWithoutNullable, trim), + (true, false) => String.Format("{0} = RequiredValue<{2}>(reader, {1}){3},", fieldName, ordinalVarName, fieldTypeWithoutNullable, trim), }; code.Line(line); } From 3a2a9f51792e70e99a8296955da2b15c23dd4e77 Mon Sep 17 00:00:00 2001 From: Joe Gallagher Date: Wed, 19 Nov 2025 14:13:37 -0500 Subject: [PATCH 5/7] rename key --- src/Pingmint.CodeGen.Sql/Yaml/Serialization.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Pingmint.CodeGen.Sql/Yaml/Serialization.cs b/src/Pingmint.CodeGen.Sql/Yaml/Serialization.cs index 8ba6108..fda28d2 100644 --- a/src/Pingmint.CodeGen.Sql/Yaml/Serialization.cs +++ b/src/Pingmint.CodeGen.Sql/Yaml/Serialization.cs @@ -65,7 +65,7 @@ protected override bool Add(string key, string value) switch (key) { case "async": this.Model.Async = value; return true; - case "trimChar": this.Model.TrimChar = value; return true; + case "trim char": this.Model.TrimChar = value; return true; default: return false; } } From 4ba7026da6ca52e37283dcb8f5acc37a6986b6dd Mon Sep 17 00:00:00 2001 From: Joe Gallagher Date: Wed, 19 Nov 2025 14:22:33 -0500 Subject: [PATCH 6/7] update packages --- .github/workflows/dotnet.yml | 2 +- .../Pingmint.CodeGen.Sql.csproj | 2 +- src/Pingmint.CodeGen.Sql/packages.lock.json | 161 ++++++------------ 3 files changed, 57 insertions(+), 108 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index d4788f1..1490b7b 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -17,7 +17,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 9.x + dotnet-version: 10.x - name: Version (release) run: | OLD=$(yq ".Project.PropertyGroup[0].Version" -p xml -o xml src/Pingmint.CodeGen.Sql/Pingmint.CodeGen.Sql.csproj) diff --git a/src/Pingmint.CodeGen.Sql/Pingmint.CodeGen.Sql.csproj b/src/Pingmint.CodeGen.Sql/Pingmint.CodeGen.Sql.csproj index 32ede9d..a680669 100644 --- a/src/Pingmint.CodeGen.Sql/Pingmint.CodeGen.Sql.csproj +++ b/src/Pingmint.CodeGen.Sql/Pingmint.CodeGen.Sql.csproj @@ -35,7 +35,7 @@ - + diff --git a/src/Pingmint.CodeGen.Sql/packages.lock.json b/src/Pingmint.CodeGen.Sql/packages.lock.json index 65e44c0..bb5f704 100644 --- a/src/Pingmint.CodeGen.Sql/packages.lock.json +++ b/src/Pingmint.CodeGen.Sql/packages.lock.json @@ -1,19 +1,20 @@ { "version": 1, "dependencies": { - "net9.0": { + "net10.0": { "Microsoft.Data.SqlClient": { "type": "Direct", - "requested": "[6.0.2, )", - "resolved": "6.0.2", - "contentHash": "RDqwzNu5slSqGy0eSgnN4fuLdGI1w9ZHBRNALrbUsykOIbXtGCpyotG0r5zz+HHtzxbe6LtcAyWcOiu0a+Fx/A==", + "requested": "[6.1.3, )", + "resolved": "6.1.3", + "contentHash": "ys/z8Tx8074CDU20EilNvBRJuJdwKSthpHkzUpt3JghnjB6GjbZusoOcCtNbhPCCWsEJqN8bxaT7HnS3UZuUDQ==", "dependencies": { - "Azure.Identity": "1.11.4", + "Azure.Core": "1.47.1", + "Azure.Identity": "1.14.2", "Microsoft.Bcl.Cryptography": "9.0.4", "Microsoft.Data.SqlClient.SNI.runtime": "6.0.2", "Microsoft.Extensions.Caching.Memory": "9.0.4", - "Microsoft.IdentityModel.JsonWebTokens": "7.5.0", - "Microsoft.IdentityModel.Protocols.OpenIdConnect": "7.5.0", + "Microsoft.IdentityModel.JsonWebTokens": "7.7.1", + "Microsoft.IdentityModel.Protocols.OpenIdConnect": "7.7.1", "Microsoft.SqlServer.Server": "1.0.0", "System.Configuration.ConfigurationManager": "9.0.4", "System.Security.Cryptography.Pkcs": "9.0.4" @@ -27,37 +28,28 @@ }, "Azure.Core": { "type": "Transitive", - "resolved": "1.38.0", - "contentHash": "IuEgCoVA0ef7E4pQtpC3+TkPbzaoQfa77HlfJDmfuaJUCVJmn7fT0izamZiryW5sYUFKizsftIxMkXKbgIcPMQ==", + "resolved": "1.47.1", + "contentHash": "oPcncSsDHuxB8SC522z47xbp2+ttkcKv2YZ90KXhRKN0YQd2+7l1UURT9EBzUNEXtkLZUOAB5xbByMTrYRh3yA==", "dependencies": { - "Microsoft.Bcl.AsyncInterfaces": "1.1.1", - "System.ClientModel": "1.0.0", - "System.Diagnostics.DiagnosticSource": "6.0.1", - "System.Memory.Data": "1.0.2", - "System.Numerics.Vectors": "4.5.0", - "System.Text.Encodings.Web": "4.7.2", - "System.Text.Json": "4.7.2", - "System.Threading.Tasks.Extensions": "4.5.4" + "Microsoft.Bcl.AsyncInterfaces": "8.0.0", + "System.ClientModel": "1.5.1", + "System.Memory.Data": "8.0.1" } }, "Azure.Identity": { "type": "Transitive", - "resolved": "1.11.4", - "contentHash": "Sf4BoE6Q3jTgFkgBkx7qztYOFELBCo+wQgpYDwal/qJ1unBH73ywPztIJKXBXORRzAeNijsuxhk94h0TIMvfYg==", + "resolved": "1.14.2", + "contentHash": "YhNMwOTwT+I2wIcJKSdP0ADyB2aK+JaYWZxO8LSRDm5w77LFr0ykR9xmt2ZV5T1gaI7xU6iNFIh/yW1dAlpddQ==", "dependencies": { - "Azure.Core": "1.38.0", - "Microsoft.Identity.Client": "4.61.3", - "Microsoft.Identity.Client.Extensions.Msal": "4.61.3", - "System.Memory": "4.5.4", - "System.Security.Cryptography.ProtectedData": "4.7.0", - "System.Text.Json": "4.7.2", - "System.Threading.Tasks.Extensions": "4.5.4" + "Azure.Core": "1.46.1", + "Microsoft.Identity.Client": "4.73.1", + "Microsoft.Identity.Client.Extensions.Msal": "4.73.1" } }, "Microsoft.Bcl.AsyncInterfaces": { "type": "Transitive", - "resolved": "1.1.1", - "contentHash": "yuvf07qFWFqtK3P/MRkEKLhn5r2UbSpVueRziSqj0yJQIKFwG1pq9mOayK3zE5qZCTs0CbrwL9M6R8VwqyGy2w==" + "resolved": "8.0.0", + "contentHash": "3WA9q9yVqJp222P3x1wYIGDAkpjAku0TMUaaQV22g6L67AI0LdOIrVS7Ht2vJfLHGSPVuqN94vIr15qn+HEkHw==" }, "Microsoft.Bcl.Cryptography": { "type": "Transitive", @@ -118,66 +110,65 @@ }, "Microsoft.Identity.Client": { "type": "Transitive", - "resolved": "4.61.3", - "contentHash": "naJo/Qm35Caaoxp5utcw+R8eU8ZtLz2ALh8S+gkekOYQ1oazfCQMWVT4NJ/FnHzdIJlm8dMz0oMpMGCabx5odA==", + "resolved": "4.73.1", + "contentHash": "NnDLS8QwYqO5ZZecL2oioi1LUqjh5Ewk4bMLzbgiXJbQmZhDLtKwLxL3DpGMlQAJ2G4KgEnvGPKa+OOgffeJbw==", "dependencies": { - "Microsoft.IdentityModel.Abstractions": "6.35.0", - "System.Diagnostics.DiagnosticSource": "6.0.1" + "Microsoft.IdentityModel.Abstractions": "6.35.0" } }, "Microsoft.Identity.Client.Extensions.Msal": { "type": "Transitive", - "resolved": "4.61.3", - "contentHash": "PWnJcznrSGr25MN8ajlc2XIDW4zCFu0U6FkpaNLEWLgd1NgFCp5uDY3mqLDgM8zCN8hqj8yo5wHYfLB2HjcdGw==", + "resolved": "4.73.1", + "contentHash": "xDztAiV2F0wI0W8FLKv5cbaBefyLD6JVaAsvgSN7bjWNCzGYzHbcOEIP5s4TJXUpQzMfUyBsFl1mC6Zmgpz0PQ==", "dependencies": { - "Microsoft.Identity.Client": "4.61.3", + "Microsoft.Identity.Client": "4.73.1", "System.Security.Cryptography.ProtectedData": "4.5.0" } }, "Microsoft.IdentityModel.Abstractions": { "type": "Transitive", - "resolved": "7.5.0", - "contentHash": "seOFPaBQh2K683eFujAuDsrO2XbOA+SvxRli+wu7kl+ZymuGQzjmmUKfyFHmDazpPOBnmOX1ZnjX7zFDZHyNIA==" + "resolved": "7.7.1", + "contentHash": "S7sHg6gLg7oFqNGLwN1qSbJDI+QcRRj8SuJ1jHyCmKSipnF6ZQL+tFV2NzVfGj/xmGT9TykQdQiBN+p5Idl4TA==" }, "Microsoft.IdentityModel.JsonWebTokens": { "type": "Transitive", - "resolved": "7.5.0", - "contentHash": "mfyiGptbcH+oYrzAtWWwuV+7MoM0G0si+9owaj6DGWInhq/N/KDj/pWHhq1ShdmBu332gjP+cppjgwBpsOj7Fg==", + "resolved": "7.7.1", + "contentHash": "3Izi75UCUssvo8LPx3OVnEeZay58qaFicrtSnbtUt7q8qQi0gy46gh4V8VUTkMVMKXV6VMyjBVmeNNgeCUJuIw==", "dependencies": { - "Microsoft.IdentityModel.Tokens": "7.5.0" + "Microsoft.IdentityModel.Tokens": "7.7.1" } }, "Microsoft.IdentityModel.Logging": { "type": "Transitive", - "resolved": "7.5.0", - "contentHash": "3BInZEajJvnTDP/YRrmJ3Fyw8XAWWR9jG+3FkhhzRJJYItVL+BEH9qlgxSmtrxp7S7N6TOv+Y+X8BG61viiehQ==", + "resolved": "7.7.1", + "contentHash": "BZNgSq/o8gsKExdYoBKPR65fdsxW0cTF8PsdqB8y011AGUJJW300S/ZIsEUD0+sOmGc003Gwv3FYbjrVjvsLNQ==", "dependencies": { - "Microsoft.IdentityModel.Abstractions": "7.5.0" + "Microsoft.IdentityModel.Abstractions": "7.7.1" } }, "Microsoft.IdentityModel.Protocols": { "type": "Transitive", - "resolved": "7.5.0", - "contentHash": "ugyb0Nm+I+UrHGYg28mL8oCV31xZrOEbs8fQkcShUoKvgk22HroD2odCnqEf56CoAFYTwoDExz8deXzrFC+TyA==", + "resolved": "7.7.1", + "contentHash": "h+fHHBGokepmCX+QZXJk4Ij8OApCb2n2ktoDkNX5CXteXsOxTHMNgjPGpAwdJMFvAL7TtGarUnk3o97NmBq2QQ==", "dependencies": { - "Microsoft.IdentityModel.Tokens": "7.5.0" + "Microsoft.IdentityModel.Tokens": "7.7.1" } }, "Microsoft.IdentityModel.Protocols.OpenIdConnect": { "type": "Transitive", - "resolved": "7.5.0", - "contentHash": "/U3I/8uutTqZr2n/zt0q08bluYklq+5VWP7ZuOGpTUR1ln5bSbrexAzdSGzrhxTxNNbHMCU8Mn2bNQvcmehAxg==", + "resolved": "7.7.1", + "contentHash": "yT2Hdj8LpPbcT9C9KlLVxXl09C8zjFaVSaApdOwuecMuoV4s6Sof/mnTDz/+F/lILPIBvrWugR9CC7iRVZgbfQ==", "dependencies": { - "Microsoft.IdentityModel.Protocols": "7.5.0", - "System.IdentityModel.Tokens.Jwt": "7.5.0" + "Microsoft.IdentityModel.Protocols": "7.7.1", + "System.IdentityModel.Tokens.Jwt": "7.7.1" } }, "Microsoft.IdentityModel.Tokens": { "type": "Transitive", - "resolved": "7.5.0", - "contentHash": "owe33wqe0ZbwBxM3D90I0XotxNyTdl85jud03d+OrUOJNnTiqnYePwBk3WU9yW0Rk5CYX+sfSim7frmu6jeEzQ==", + "resolved": "7.7.1", + "contentHash": "fQ0VVCba75lknUHGldi3iTKAYUQqbzp1Un8+d9cm9nON0Gs8NAkXddNg8iaUB0qi/ybtAmNWizTR4avdkCJ9pQ==", "dependencies": { - "Microsoft.IdentityModel.Logging": "7.5.0" + "Microsoft.IdentityModel.Logging": "7.7.1" } }, "Microsoft.SqlServer.Server": { @@ -187,11 +178,11 @@ }, "System.ClientModel": { "type": "Transitive", - "resolved": "1.0.0", - "contentHash": "I3CVkvxeqFYjIVEP59DnjbeoGNfo/+SZrCLpRz2v/g0gpCHaEMPtWSY0s9k/7jR1rAsLNg2z2u1JRB76tPjnIw==", + "resolved": "1.5.1", + "contentHash": "k2jKSO0X45IqhVOT9iQB4xralNN9foRQsRvXBTyRpAVxyzCJlG895T9qYrQWbcJ6OQXxOouJQ37x5nZH5XKK+A==", "dependencies": { - "System.Memory.Data": "1.0.2", - "System.Text.Json": "4.7.2" + "Microsoft.Extensions.Logging.Abstractions": "8.0.3", + "System.Memory.Data": "8.0.1" } }, "System.Configuration.ConfigurationManager": { @@ -203,14 +194,6 @@ "System.Security.Cryptography.ProtectedData": "9.0.4" } }, - "System.Diagnostics.DiagnosticSource": { - "type": "Transitive", - "resolved": "6.0.1", - "contentHash": "KiLYDu2k2J82Q9BJpWiuQqCkFjRBWVq4jDzKKWawVi9KWzyD0XG3cmfX0vqTQlL14Wi9EufJrbL0+KCLTbqWiQ==", - "dependencies": { - "System.Runtime.CompilerServices.Unsafe": "6.0.0" - } - }, "System.Diagnostics.EventLog": { "type": "Transitive", "resolved": "9.0.4", @@ -218,36 +201,17 @@ }, "System.IdentityModel.Tokens.Jwt": { "type": "Transitive", - "resolved": "7.5.0", - "contentHash": "D0TtrWOfoPdyYSlvOGaU9F1QR+qrbgJ/4eiEsQkIz7YQKIKkGXQldXukn6cYG9OahSq5UVMvyAIObECpH6Wglg==", + "resolved": "7.7.1", + "contentHash": "rQkO1YbAjLwnDJSMpRhRtrc6XwIcEOcUvoEcge+evurpzSZM3UNK+MZfD3sKyTlYsvknZ6eJjSBfnmXqwOsT9Q==", "dependencies": { - "Microsoft.IdentityModel.JsonWebTokens": "7.5.0", - "Microsoft.IdentityModel.Tokens": "7.5.0" + "Microsoft.IdentityModel.JsonWebTokens": "7.7.1", + "Microsoft.IdentityModel.Tokens": "7.7.1" } }, - "System.Memory": { - "type": "Transitive", - "resolved": "4.5.4", - "contentHash": "1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==" - }, "System.Memory.Data": { "type": "Transitive", - "resolved": "1.0.2", - "contentHash": "JGkzeqgBsiZwKJZ1IxPNsDFZDhUvuEdX8L8BDC8N3KOj+6zMcNU28CNN59TpZE/VJYy9cP+5M+sbxtWJx3/xtw==", - "dependencies": { - "System.Text.Encodings.Web": "4.7.2", - "System.Text.Json": "4.6.0" - } - }, - "System.Numerics.Vectors": { - "type": "Transitive", - "resolved": "4.5.0", - "contentHash": "QQTlPTl06J/iiDbJCiepZ4H//BVraReU4O4EoRw1U02H5TLUIT7xn3GnDp9AXPSlJUDyFs4uWjWafNX6WrAojQ==" - }, - "System.Runtime.CompilerServices.Unsafe": { - "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==" + "resolved": "8.0.1", + "contentHash": "BVYuec3jV23EMRDeR7Dr1/qhx7369dZzJ9IWy2xylvb4YfXsrUxspWc4UWYid/tj4zZK58uGZqn2WQiaDMhmAg==" }, "System.Security.Cryptography.Pkcs": { "type": "Transitive", @@ -258,22 +222,7 @@ "type": "Transitive", "resolved": "9.0.4", "contentHash": "o94k2RKuAce3GeDMlUvIXlhVa1kWpJw95E6C9LwW0KlG0nj5+SgCiIxJ2Eroqb9sLtG1mEMbFttZIBZ13EJPvQ==" - }, - "System.Text.Encodings.Web": { - "type": "Transitive", - "resolved": "4.7.2", - "contentHash": "iTUgB/WtrZ1sWZs84F2hwyQhiRH6QNjQv2DkwrH+WP6RoFga2Q1m3f9/Q7FG8cck8AdHitQkmkXSY8qylcDmuA==" - }, - "System.Text.Json": { - "type": "Transitive", - "resolved": "4.7.2", - "contentHash": "TcMd95wcrubm9nHvJEQs70rC0H/8omiSGGpU4FQ/ZA1URIqD4pjmFJh2Mfv1yH1eHgJDWTi2hMDXwTET+zOOyg==" - }, - "System.Threading.Tasks.Extensions": { - "type": "Transitive", - "resolved": "4.5.4", - "contentHash": "zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==" } } } -} +} \ No newline at end of file From 874215008c4892f1233d1a66f06fbdca8f8071e6 Mon Sep 17 00:00:00 2001 From: Joe Gallagher Date: Wed, 19 Nov 2025 14:29:01 -0500 Subject: [PATCH 7/7] update doc --- README.md | 4 ++++ src/Pingmint.CodeGen.Sql/CodeFile.cs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fd5638d..8eed94a 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,10 @@ sqlclient: async: false ``` +### `trim char` + +Set `trim char: true` to remove trailing spaces on CHAR(n) columns. + ## Extended properties Extended properties may be added to database objects to include metadata in the generated code. diff --git a/src/Pingmint.CodeGen.Sql/CodeFile.cs b/src/Pingmint.CodeGen.Sql/CodeFile.cs index b674e45..952f946 100644 --- a/src/Pingmint.CodeGen.Sql/CodeFile.cs +++ b/src/Pingmint.CodeGen.Sql/CodeFile.cs @@ -144,7 +144,7 @@ public String GenerateCode() String trim = String.Empty; if (TrimChar && property.SqlDbType == SqlDbType.Char) { - trim = ".Trim()"; + trim = ".TrimEnd()"; if (property.ColumnIsNullable) { trim = "?" + trim;