StrataFrame Forum

Alternate values on NULL Get/Set

http://forum.strataframe.net/Topic12008.aspx

By Andria Jensen - 10/15/2007

I have been playing with the settings in the BO Mapper for the NULL Value Options.  What I want to accomplish is this...

1.  Get values with the replacement value applied if a null is in the db.  i.e. Get out a "" for a NULL string value.

2.  I want to be able to control what values are going back into the database.  Sometimes a NULL means different things than a "" string value or a 0 decimal value.  Is there some way to control how it puts it back in, but always return it with the replacement value applied?

By StrataFrame Team - 10/16/2007

1) The replacement value options are designed for exactly that... you can use String.Empty or "" for the replacement value.

2) There is an option for returning a replacement on null and setting null on the replacement.  If you use "" for the replacement and try to set that as the value, the property will set NULL back to the database.  However if you want to differentiate between NULL and "", then you'll most likely have to use the CurrentRow property on the business object to set null values back.  bo.CurrentRow("field") = DBNull.Value will do the trick and bypass the strong-typed property.