That's a great pattern, and I'm glad to see it in CLR 2.0; thanks for
pointing it out.
I've done something similar with a passive record container class that
passes values between tiers. This record container holds the field values
of a DB record as properties of appropriate CLR types, tracks whether a
field is NULL and throws an exception if you try to read the value when it's
NULL. So you end up with code like the following for a record container,
rc:
if (rc.IsNull("FirstName")) {
someTextBox.Value = "";
} else {
someTextBox.Value = rc.FirstName;
}
// or, going the other way:
if (someTextBox.Value.Length == 0) {
rc.SetNull("FirstName");
} else {
rc.FirstName = someTextBox.Value;
}
Database NULLs are a pain in the touche no matter how you handle them.
--Bob
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:eG**************@TK2MSFTNGP09.phx.gbl...
Either that, or if you can use the beta of .NET 2.0,
Nullable<DateTime>.
Hope this helps.