Erik Porter's Blog

Life and Development at Microsoft and Other Technology Discussions

News

    Interesting Types and SqlTypes Tidbit

    I talked with a guy from the Data Access Team and picked up something I thought was really interesting so I thought I'd share.  Apparently, when .NET was in it's early stages, all value types (Int32, Single, Guid, etc) were Nullable (IsNull Flag), but apparently it was decided that the extra bit on each type was too much, so it was moved into the SqlTypes Classes.  He admitted (as they all have now) that this was a horrible mistake (couldn't agree more).

    Comments

    James said:

    Erik,

    Thanks for the tidbid. Why was this such a horrible mistake? Are there any discussions you can point us too that further clarify back stepping on this?

    Thanks

    James
    # April 8, 2004 2:05 AM

    HumanCompiler said:

    Hi James,

    It's really just because the value types aren't nullable, even though they can be in a DB, so having to check for DBNull is a pain and doesn't really follow patterns like everything else so you have to either build your own custom types to handle null or write shared methods. Here's one link, but I'm sure there are many more...

    http://weblogs.asp.net/ericgu/archive/2004/03/23/95011.aspx
    # April 8, 2004 3:53 AM

    Jim Bolla said:

    I use the SqlTypes. They are nice except they aren't serializable.
    # April 8, 2004 1:14 PM

    Drew Marsh said:

    There are people in both camps of this argument. Personally I think it would have been horrible if that bit were there on the intrinsic primitives. You should not force nullable semantics where they don't belong. That said, anyone on the side of the fence where they want "nullability" on the intrinsics going forward will need only look to Whidbey's Nullable<T> generic for the solution (e.g. Nullable<int>). Now everyone can be happy!
    # April 8, 2004 2:02 PM