Commit 9f0fdbc
committed
Updated
The `DateTime` data type in SQL has a lower precision than the `DateTime` data type in C#. As a result, when storing the `version` in `topic.VersionHistory`, a different version was getting saved than in the database. In practice, this resulted in an inability to roll back versions that had been created since the last application reset. (Previous versions worked, as they were loaded with the lower-precision value from the database.) This is mitigated by instead initializing the `version` variable as a `SqlDateTime` object, which uses the same precision as the database.
While I was at it, I move the `VersionHistory` insert into the `try/catch` block so that a `version` won't be prepended if there was an error during the `Save()` operation. (In practice, this is unlikely, and we haven't had any reports of this being a concern, but it's an easy fix to make while modifying the code.)version to use SqlDateTime
1 parent ab19b9d commit 9f0fdbc
1 file changed
Lines changed: 5 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
333 | 334 | | |
334 | 335 | | |
335 | 336 | | |
336 | | - | |
| 337 | + | |
337 | 338 | | |
338 | 339 | | |
339 | 340 | | |
| |||
344 | 345 | | |
345 | 346 | | |
346 | 347 | | |
347 | | - | |
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
351 | 351 | | |
| 352 | + | |
352 | 353 | | |
353 | 354 | | |
354 | 355 | | |
| |||
369 | 370 | | |
370 | 371 | | |
371 | 372 | | |
| 373 | + | |
| 374 | + | |
372 | 375 | | |
373 | 376 | | |
374 | 377 | | |
| |||
390 | 393 | | |
391 | 394 | | |
392 | 395 | | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | 396 | | |
399 | 397 | | |
400 | 398 | | |
| |||
0 commit comments