Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 9077c59

Browse files
committed
Fix RowVersion for other DB's
1 parent d99d95b commit 9077c59

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/ServiceStack.OrmLite/Converters/SpecialConverters.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,18 @@ public class RowVersionConverter : OrmLiteConverter
6969

7070
public override object FromDbValue(Type fieldType, object value)
7171
{
72-
var bytes = value as byte[];
73-
if (bytes != null)
72+
if (value is byte[] bytes)
7473
{
7574
if (fieldType == typeof(byte[])) return bytes;
7675
if (fieldType == typeof(ulong)) return OrmLiteUtils.ConvertToULong(bytes);
7776

7877
// an SQL row version has to be declared as either byte[] OR ulong...
7978
throw new Exception("Rowversion property must be declared as either byte[] or ulong");
8079
}
81-
return null;
80+
81+
return value != null
82+
? this.ConvertNumber(typeof(ulong), value)
83+
: null;
8284
}
8385
}
8486

0 commit comments

Comments
 (0)