I’m in the middle of a long-overdue update of our legacy codebase, from ServiceStack 5.7 to 6.3. We are using OrmLite, and we have a few SQL tables with “nullable time(7)” columns, which we are representing as “TimeSpan?” properties in our model classes.
In our AppHost class, as well as in the equivalent class for our unit/integration tests that use an in-memory database, we’re doing this:
All of that has been working for us, up until now. After the upgrade to the latest stable versions of all of the ServiceStack packages (6.2 up until a few days ago, and now 6.3), when I run my unit tests, with all of the same RegisterConverter code in place, I’m getting the following error when attempting to call the OrmLite SaveAll method for the class/table with the TimeSpan:
Operand type clash: bigint is incompatible with time
I can confirm that RegisterConverter is being called, as before, without throwing an exception. And none of the unit test code has changed. But SaveAll has suddenly started throwing this error, so it’s seemingly ignoring the TimeConverter that I’m trying to get it to use.
I’ve tried to replicate the issue with a simple table as a test, but the following passes locally and on our CI.
If you can take a look at the test to see if I’ve made any assumptions that doesn’t match your current setup?
Other things to check, when you’re application is starting up, can you confirm the RegisterConverter is being hit? and that you are not using another SqlServerDialect.Provider instance for a named connection or other setup that is has different configuration?
Thanks for the quick response! It’s definitely hitting my RegisterConverter call at startup. I don’t believe I’m using another SqlServerDialect.Provider anywhere… checking through all of the code now. Thanks for the test code! I will try adding that to our set of unit tests to see if it passes for me. The only obvious difference I see is that we’re using db.SaveAll, instead of a series of db.Insert calls. I will update again once I’ve tried running that test in our codebase…
(Asterisks added for emphasis - I was trying to make that text bold, but I guess it doesn’t work inside a code block!)
So… I guess I’m calling it on the specific instance, instead of calling it as a static method? Does that make sense? In any case, I’m no longer getting the error when I save to that table, so thank you!!