@@ -100,6 +100,28 @@ public override string GetQuotedTableName(ModelDefinition modelDef)
100
100
return string . Format ( "\" {0}\" .\" {1}\" " , escapedSchema , NamingStrategy . GetTableName ( modelDef . ModelName ) ) ;
101
101
}
102
102
103
+ public override void SetDbValue ( FieldDefinition fieldDef , IDataReader reader , int colIndex , object instance )
104
+ {
105
+ if ( fieldDef . IsRowVersion )
106
+ {
107
+ var bytes = reader . GetValue ( colIndex ) as byte [ ] ;
108
+ if ( bytes != null )
109
+ {
110
+ Array . Reverse ( bytes ) ; //Correct Endianness
111
+ var ulongValue = BitConverter . ToUInt64 ( bytes , 0 ) ;
112
+ try
113
+ {
114
+ fieldDef . SetValueFn ( instance , ulongValue ) ;
115
+ }
116
+ catch ( NullReferenceException ignore ) { }
117
+ }
118
+ }
119
+ else
120
+ {
121
+ base . SetDbValue ( fieldDef , reader , colIndex , instance ) ;
122
+ }
123
+ }
124
+
103
125
public override object ConvertDbValue ( object value , Type type )
104
126
{
105
127
try
@@ -324,6 +346,9 @@ public override string ToChangeColumnNameStatement(Type modelType, FieldDefiniti
324
346
public override string GetColumnDefinition ( string fieldName , Type fieldType , bool isPrimaryKey , bool autoIncrement ,
325
347
bool isNullable , bool isRowVersion , int ? fieldLength , int ? scale , string defaultValue , string customFieldDefinition )
326
348
{
349
+ if ( isRowVersion )
350
+ return "{0} rowversion NOT NULL" . Fmt ( fieldName ) ;
351
+
327
352
var definition = base . GetColumnDefinition ( fieldName , fieldType , isPrimaryKey , autoIncrement ,
328
353
isNullable , isRowVersion , fieldLength , scale , defaultValue , customFieldDefinition ) ;
329
354
0 commit comments