Skip to content

Commit 1450fb6

Browse files
committed
Support generating NULL sql parameters for null properties
1 parent 9096ecb commit 1450fb6

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

Poco.Sql.NetCore/ValuesObject.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,14 @@ PropertyInfo propertyInfo in
4848
if (propertyInfo.PropertyType == typeof (DateTime) && (DateTime) val == DateTime.MinValue)
4949
val = (DateTime) System.Data.SqlTypes.SqlDateTime.MinValue;
5050

51-
objDic.Add(propertyInfo.Name, val);
51+
if (val == null)
52+
{
53+
objDic.Add(propertyInfo.Name, DBNull.Value);
54+
}
55+
else
56+
{
57+
objDic.Add(propertyInfo.Name, val);
58+
}
5259
}
5360
}
5461
}

0 commit comments

Comments
 (0)