Plugin Developer DiscussionDiscussion for FogBugz Plugin developers |
||
I wanted to do something with CFixFor classes. Now they have properties dt and dtStart, both wich can be NULL in the database. Fine.
The docs say: "The planned date in UTC of the release, or Null for (None)." http://www.fogcreek.com/fogbugz/library/70/html/30638579.htm and "The earliest possible start date in UTC, or Null for start as soon as possible." http://www.fogcreek.com/fogbugz/library/70/html/2BE89402.htm However, both are declared as plain DateTime properties, not nullable (not DateTime?). Therefore, they will never be null. So how exacly is this supposed to work? I looked into api.Database to see if there was something like an IsNull function which would tell me if a specific DateTime is a NULL placeholder value, but no, nothing. So, is this an error in the API, did I miss something?
Hi Arsène,
Yes, you are correct, the documentation is incorrect and beyond that what FogBugz does is a bit odd. We use System.DateTime.MinValue to indicate a no date (and this maps to a NULL in the database). Can you work with that? I've opened a bug to at least fix the docs on this. Thanks! Brett
Thanks for the quick answer. I thought that this may be the NULL placeholder value, but since I didn't see any documentation pointing me in this direction I didn't want to use a value which may or may not be correct.
Maybe adding some static helper functions which check for the pseudo-NULLs (the DateTime.MinValue, -1 for ix* etc.) may hide the internals a bit, so that code can rely on having functions which correctly identify the internal NULL values. |
Powered by FogBugz