diff --git a/src/Pingmint.CodeGen.Sql/CodeFile.cs b/src/Pingmint.CodeGen.Sql/CodeFile.cs index 952f946..c969e72 100644 --- a/src/Pingmint.CodeGen.Sql/CodeFile.cs +++ b/src/Pingmint.CodeGen.Sql/CodeFile.cs @@ -173,11 +173,9 @@ public String GenerateCode() using var tableClass = code.PartialClass("public sealed", dataTableClassName, "DataTable"); code.Line("public {0}() : this(new List<{1}>()) {{ }}", dataTableClassName, rowClassName); - code.Line("public {0}(List<{1}> rows) : base()", dataTableClassName, rowClassName); + code.Line("public {0}(List<{1}>? rows) : base()", dataTableClassName, rowClassName); using (code.CreateBraceScope()) { - code.Line("ArgumentNullException.ThrowIfNull(rows);"); - code.Line(); foreach (var col in record.Properties) { var allowDbNull = col.ColumnIsNullable ? "true" : "false"; @@ -185,7 +183,7 @@ public String GenerateCode() var propertyTypeName = col.FieldTypeWithoutNullable; code.Line("base.Columns.Add(new DataColumn() {{ ColumnName = \"{0}\", DataType = typeof({1}), AllowDBNull = {2}{3} }});", col.ColumnName, propertyTypeName, allowDbNull, maxLength); } - using (code.ForEach("var row in rows")) + using (code.ForEach("var row in rows ?? []")) { var parameterBuilder = String.Empty; foreach (var col in record.Properties) diff --git a/src/Pingmint.CodeGen.Sql/Pingmint.CodeGen.Sql.csproj b/src/Pingmint.CodeGen.Sql/Pingmint.CodeGen.Sql.csproj index a680669..29b6821 100644 --- a/src/Pingmint.CodeGen.Sql/Pingmint.CodeGen.Sql.csproj +++ b/src/Pingmint.CodeGen.Sql/Pingmint.CodeGen.Sql.csproj @@ -1,7 +1,7 @@ - 0.47 + 0.48 Exe net10.0 latest