Exception calling UpdateNonDefaults

Hi,

when I call this.Db.UpdateNonDefaults I get an argument exception “No non-null or non-default values were provided for type: …”.

Is there an elegant way to check whether the object that should be saved has any non-null values?

Greetings
Andre

There’s no proper elegant way as it needs to look at OrmLite metadata field definitions to only look at updatable values which it does in:

A decent approach would be to use ToObjectDictionary extension to convert the instance into a Dictionary<string,object> and check if it has any values which aren’t null or !Equals(value, type.GetDefaultValue()) or the PrimaryKey.

1 Like