Plugin Developer Discussion

Discussion for FogBugz Plugin developers

API, structs and NULL

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?
Arsène von Wyss Send private email
Tuesday, November 3, 2009
 
 
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
Brett Kiefer Send private email
Tuesday, November 3, 2009
 
 
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.
Arsène von Wyss Send private email
Tuesday, November 3, 2009
 
 
Hi Arsène-
Yes, that's what we do internally, and we need to expose them in the API.
Thanks!
Brett
Brett Kiefer Send private email
Wednesday, November 4, 2009
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz