Telerik ORM : Row not found: GenericOID@ OptimisticVerificationException

This kind of error occurred When DataAccess tries to update the row in the database which has the original values for the fields that have changed.

The reason the update fails is that the artificial columns added at runtime are nullable but the CLR property which these columns are mapped to are all non-nullable. Ex – bit column is mapped to Boolean CLR property.

The generated UPDATE statement tries to find a row with the CLR default value i.e 0 but the value in the column is NULL.

I have updated the method that maps the artificial properties as follows –

var propType = Type.GetType(property.PropertyType);
propType = GetNullableType(propType);
var primitivePropertyConfiguration = myConfig.HasArtificialPrimitiveProperty(property.PropertyName,propType).HasFieldName(property.PropertyName);

Here I check if the Type of the field is a value type and if it is, then I create a nullable CLR type instead of the non-nullable type.

The helper method used is as below

public static Type GetNullableType(Type type)
if (type.IsValueType)
Type nullable = typeof(Nullable);
return nullable.MakeGenericType(new[] { type });
return type;

Hope this help !

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s