Conditional put fails on DateTime.MinValue

Jun 30, 2010 at 11:30 AM
Hi, we have been using the library for a while and we haven't seen this issue till recently, what is happening is that a conditional put for a version controlled DateTime value is saved in SimpleDB with the DateTime.MinValue and any subsequent puts all fail because of version control conflict. Here's the property: [Version(VersioningBehavior.AutoIncrementAndConditionallyUpdate)] public DateTime LastModified { get; set; } and here's what written in SimpleDB when the object is saved: LastModified 0001-01-01T00:00:00.000 The code that creates the object and subsequently updates it doesn't update the LastModified field itself. Have you come across anything like this in the past? Thanks,
Jun 30, 2010 at 3:22 PM
Edited Jun 30, 2010 at 3:36 PM

I have not seen that before, and I'm using this feature in my own projects with no issues (latest Savant code). Additional information will help resolve:

  1. Savant release you're using
  2. Exact exception/error message
  3. Is this happening 100% of the time? Is it possible you've got old data in simple db (stored before auto-increment was added to your version)?
  4. Can you provide an isolated test case that reproduces the behavior?
  5. Are you saving with a partial-operation (PutAttributes) or always saving the entire object?

UPDATE: Oops, forgot I fixed a recent issue that could be causing this: The fix is in the trunk code but not yet in a release. Version properties were not being auto-incremented on batch-put operations, which Savant performs automatically when you invoke Put with more than one item at once. Also, just an FYI in case this is actually the cause of your problem, SimpleDB doesn't support conditional checks for batch puts. So be aware that if you are putting multiple items at once using Savant your conditional checks are not being enforced.


Jun 30, 2010 at 3:51 PM

I've added an issue to improve visibility of the batch-put + conditional update behavior. I'll appreciate any feedback you may have:


Jul 6, 2010 at 7:44 PM
Edited Jul 6, 2010 at 7:45 PM
Hi Ashley, Just had another look at the data in our Database which had the issue with the DateTime.MinValue and it seems to relate to the batch-put issue ( you posted above, which also explains why we haven't seen this problem manifest itself in other places where we're doing the same thing.
Jul 6, 2010 at 7:47 PM
Oh, and just out of curiosity, what are you using to format your posts on here?
Jul 6, 2010 at 8:14 PM
Thanks for the update. I'm glad to hear that was indeed the issue, and I'm sorry for any inconvenience it caused you. Re the formatting: The Codeplex post editor includes a simple formatting toolbar, but it is flakey and often doesn't appear when you create or edit a post. I've had problems with both Firefox and IE, but IE seems to be a bit more reliable.