Amazon.com Widgets

Framework Design Guidelines: System.DBNull

Continuing in our weekly blog post series that highlights a few of the new image[5]_thumb[2]_thumb[2]_thumbadditions to the Framework Design Guidelines 2nd edition.. This content is found in the Nullable<T> section of Chapter 8: Usage Guidelines. Pablo helps us out with some subtle details that might really come in handy.

AVOID using System.DBNull. Prefer Nullable<T> instead.

PABLO CASTRO

Nullable<T> is in general a better representation of optional database values. One thing to consider though is that while Nullable<T> gives you the ability to represent null values, you don’t get database null operational semantics. Specifically, you don’t get null propagation through operators and functions. If you deeply care about the propagation semantics, consider sticking with DBNull.

Published 09 February 09 05:56 by BradA

Comments

# Framework Design Guidelines: System.DBNull - Click &amp; Solve said on February 9, 2009 9:38 PM:

PingBack from http://www.clickandsolve.com/?p=5573

# What's New said on February 10, 2009 2:54 AM:

Continuing in our weekly blog post series that highlights a few of the new additions to the Framework

# Carlo Kok said on February 10, 2009 3:18 AM:

null propagation is a language feature though, not a platform one. Our compiler (Delphi Prism) does do null propagation when using nullable types expressions.

# DotNetShoutout said on February 10, 2009 11:45 AM:

Thank you for submitting this cool story - Trackback from DotNetShoutout

# asdf said on February 10, 2009 1:11 PM:

an example of each would have been great

# Jerry Odom said on February 11, 2009 10:27 AM:

LINQ to SQL knocks out some of these issues right?    My dbml objects come over as Nullable.

# Sam Gentile's Blog (if (DeveloperTask == Communication && OS == Windows) said on February 16, 2009 12:58 PM:

DDD/ALT.NET Casey has written a bunch more in his DDD series since my last update 4) DDD: There Is No Database 5) DDD: Command Query Separation as an Architectural Concept 6) DDD: Entities and Value Objects 7) DDD: Where is the Code? 8) DDD: Download

New Comments to this post are disabled

Search

This Blog

Syndication

Page view tracker