Alternate values on NULL Get/Set


Author
Message
Andria Jensen
Andria Jensen
StrataFrame User (444 reputation)StrataFrame User (444 reputation)StrataFrame User (444 reputation)StrataFrame User (444 reputation)StrataFrame User (444 reputation)StrataFrame User (444 reputation)StrataFrame User (444 reputation)StrataFrame User (444 reputation)StrataFrame User (444 reputation)
Group: Forum Members
Posts: 336, Visits: 497
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?

StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
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.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search