Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Cinorid committed Feb 19, 2023
1 parent e4c33af commit b8283af
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion PocoClassGenerator/PocoClassGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ where OBJECT_NAME(fkcol.[object_id]) = '{tableName}'
if (!allowDbNull && !(key || computed) && string.IsNullOrEmpty(defaultValue))
builder.AppendLine(" [System.ComponentModel.DataAnnotations.Required()]");

if (!string.IsNullOrEmpty(defaultValue) && !defaultValue.Contains('\''))
if ((type == typeof(string) || type == typeof(DateTime)) && !string.IsNullOrEmpty(defaultValue) && !defaultValue.Contains('\''))
builder.AppendLine($" [System.ComponentModel.DefaultValue(null)]//Default Value: {defaultValue}");
else if (!string.IsNullOrEmpty(defaultValue))
builder.AppendLine($" [System.ComponentModel.DefaultValue{defaultValue.Replace("'", "\"")}]");
Expand Down

0 comments on commit b8283af

Please sign in to comment.