ServiceStack.OrmLite method UpdateAddAsync is doubling decimal variables

in our application, we used UpdateAddAsync to update/Insert to SQL database tables.
This issue is sometimes, this method will double the decimal columns. after debugging the application, the sql script it produces for decimal column is as follows: “Column1” = “Column1” + @Column1. which explains why decimal column is doubling.
so is this a bug or a feature? why would UpdateAddAsync generate such script?

Environment: .net Core 3.0, ServiceStack 5.9.0
Language: C#

Hi @yjing,

This method UpdateAdd/UpdateAddAsync increments values as described in examples from the OrmLite documentation.

The functionality you are describing with “update/insert” is commonly referred to as upsert which the UpdateAdd methods don’t perform.

1 Like

ah yes, the name of the method confused me. when i used this method, all the string columns updated just fine.
there two other cases have abnormal behaviors:

  1. if the current decimal column is NULL, then updateadd will not update the column
  2. if the decimal column casted into a string variable in the object model, then updateadd will perform the regular update instead of increasement. ( i think this make senses, since the OrmLite query is built based on the object model)

I think the use case here is to add value to numbered column without querying to get the original value first.
thanks for your responses @layoric