Skip to content

Commit dbc129f

Browse files
NH-3919 - Timestamp cleanup of code intended to default null to now but without effect.
1 parent c06e510 commit dbc129f

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

src/NHibernate/Type/TimestampType.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
using System;
2-
using NHibernate.Engine;
32

43
namespace NHibernate.Type
54
{
65
/// <summary>
7-
/// This is almost the exact same type as the <see cref="DateTimeType" /> excepted it can be used
8-
/// in the version column, stores it to the accuracy the database supports
9-
/// and will default to the value of <see cref="AbstractDateTimeType.Now" /> if the value is not valid.
6+
/// This is almost the exact same type as the <see cref="DateTimeType" />.retrieved
107
/// </summary>
118
/// <remarks>
129
/// <para>
@@ -34,10 +31,6 @@ public class TimestampType : AbstractDateTimeType
3431
/// <inheritdoc />
3532
public override string Name => "Timestamp";
3633

37-
/// <inheritdoc />
38-
protected override DateTime GetDateTimeToSet(object value, ISessionImplementor session) =>
39-
(value as DateTime?) ?? Now;
40-
4134
/// <summary>
4235
/// Retrieve the string representation of the timestamp object. This is in the following format:
4336
/// <code>

src/NHibernate/Type/TimestampUtcType.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
namespace NHibernate.Type
55
{
66
/// <summary>
7-
/// This is almost the exact same type as the <see cref="UtcDateTimeType" /> excepted it can be used
8-
/// in the version column, stores it to the accuracy the database supports
9-
/// and will default to the value of <see cref="AbstractDateTimeType.Now" /> if the value is not a datetime.
7+
/// This is almost the exact same type as the <see cref="UtcDateTimeType" /> It is intended
8+
/// for use as the version column.
109
/// Moreover, if the value is not an UTC value, it will throw.
1110
/// </summary>
1211
/// <remarks>
@@ -44,7 +43,7 @@ public class TimestampUtcType : TimestampType
4443
/// <inheritdoc />
4544
protected override DateTime GetDateTimeToSet(object value, ISessionImplementor session)
4645
{
47-
var dbValue = base.GetDateTimeToSet(value, session);
46+
var dbValue = (DateTime) value;
4847
if (dbValue.Kind != DateTimeKind.Utc)
4948
throw new ArgumentException("Kind is NOT Utc", nameof(value));
5049
return dbValue;

0 commit comments

Comments
 (0)