﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » BO Mapper - Custom Field Properties (NULL Value Option)</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Wed, 27 May 2026 21:42:13 GMT</lastBuildDate><ttl>20</ttl><item><title>BO Mapper - Custom Field Properties (NULL Value Option)</title><link>http://forum.strataframe.net/FindPost8468.aspx</link><description>In 1.6 I noticed two new 'NULL Value Options' in customer field properties (BO Mapper). I don't see&amp;nbsp;these explained in the documentation. Can you explain how to use them?&lt;/P&gt;&lt;P&gt;1) Return Alternate on Null / Set Null on Alternate (reference type)&lt;/P&gt;&lt;P&gt;2) Return Alternate on Null / Set Null on Alternate (value type)</description><pubDate>Fri, 10 Aug 2007 09:26:39 GMT</pubDate><dc:creator>Tim Dol</dc:creator></item><item><title>RE: BO Mapper - Custom Field Properties (NULL Value Option)</title><link>http://forum.strataframe.net/FindPost10799.aspx</link><description>Yep, Peter is right.&amp;nbsp; Any structure is a value type, and by definition, always has a value (you will never get a NullReferenceException by referencing a value type variable in code...).&amp;nbsp; Reference types are classes, and the variable only stores a reference to the object, not the actual object, so the reference can be a null pointer (allowing you to get a NullReferenceException).&amp;nbsp; So, Peter is right: simple types are all value types, while classes are all reference types.&amp;nbsp; You can always tell by opening the Object Browser in VS (View -&amp;gt; Object Browser) and looking at the icon next to the type.&lt;/P&gt;&lt;P&gt;&lt;IMG src="http://forum.strataframe.net/Uploads/Images/c1cd5736-423c-44e8-be96-39ea.jpg"&gt;&lt;/P&gt;&lt;P&gt;You will notice that the symbol next to the IntXX types indicates a simple type, which is always a value type.&amp;nbsp;&amp;nbsp;Also, the symbol next to IntPtr is thicker, which represents a structure, which is also a value type.&amp;nbsp; The thinner symbol next to the exception types indicates that the types are classes, which are reference types.&lt;/P&gt;&lt;P&gt;You'll also notice that when you expand the plus sign beside the value types, they all inherit from System.ValueType.&amp;nbsp; You cannot directly inherit from ValueType (I don't think...), but the compiler automatically does this when you define something as a structure (the same way a class you define automatically inherits from System.Object).&lt;/P&gt;&lt;P&gt;Hope that helps explain things some more :)</description><pubDate>Fri, 10 Aug 2007 09:26:39 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: BO Mapper - Custom Field Properties (NULL Value Option)</title><link>http://forum.strataframe.net/FindPost10796.aspx</link><description>Thanks Peter...that does indeed help!</description><pubDate>Fri, 10 Aug 2007 08:36:18 GMT</pubDate><dc:creator>choyt</dc:creator></item><item><title>RE: BO Mapper - Custom Field Properties (NULL Value Option)</title><link>http://forum.strataframe.net/FindPost10792.aspx</link><description>G'day&lt;P&gt;Value Types are those that derive from the ValueType Class, and are allocated on the Stack and therefore are deallocated as soon as they go out of scope. They include Boolean, Byte, Char, Decimal, Single, Double, all the integer types, DateTime, Guid, Timespan.&lt;/P&gt;&lt;P&gt;Reference Types are allocated on the heap and are cleaned up by garbage collection. They include String, Array etc.&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;Peter</description><pubDate>Thu, 09 Aug 2007 19:25:42 GMT</pubDate><dc:creator>Peter Denton</dc:creator></item><item><title>RE: BO Mapper - Custom Field Properties (NULL Value Option)</title><link>http://forum.strataframe.net/FindPost10791.aspx</link><description>Ok...time for a really stupid question...(and boy do I feel stupid asking this)...but which datatypes are value and which are reference? I understand that only Value types can be null so I'm guessing that a Date is a reference and an Int32 would be value? &lt;/P&gt;&lt;P&gt;Thanks!</description><pubDate>Thu, 09 Aug 2007 16:09:05 GMT</pubDate><dc:creator>choyt</dc:creator></item><item><title>RE: BO Mapper - Custom Field Properties (NULL Value Option)</title><link>http://forum.strataframe.net/FindPost8483.aspx</link><description>Yep, Peter is right.&amp;nbsp; The "Return Alternate on NULL" option only returned an alternate value if there was a DBNull.Value in the database.&amp;nbsp; However, if you set the property back to your alternate value, that alternate value was placed in the&amp;nbsp;DataTable (not a DBNull.Value value).&amp;nbsp; &lt;/P&gt;&lt;P&gt;With the "Return Alternate on Null / Set Null on Alternate" options, it works the same as the above with a Get (the alternate is returned in the case of the DBNull.Value in the DataTable); however, the Set now tests the incoming value and if it equals the alternate value, DBNull.Value is copied into the DataTable.&lt;/P&gt;&lt;P&gt;The difference between the (reference type) and (value type) options really only affects VB.&amp;nbsp; When you specify the value type option, the = operator is used to compare the alternate value to the incoming value for the Set; with the reference type option, the "Is" operator is used to compare the alternate value to the incoming value.&amp;nbsp; With C#, both values do the same thing... since the "is" keyword is not a comparison operator like it is in VB; in C#, the "==" operator is used for both.&amp;nbsp; So, generally, you're going to want to use the (value type) option.&amp;nbsp; Only in a few cases in VB are you actually going to want to use the "Is" operator to compare your alternate to the value.</description><pubDate>Wed, 25 Apr 2007 09:01:32 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: BO Mapper - Custom Field Properties (NULL Value Option)</title><link>http://forum.strataframe.net/FindPost8474.aspx</link><description>Hi,&lt;/P&gt;&lt;P&gt;Having just gone down this path I can offer this insight - it enables you to propergate nulls into your database. In my&amp;nbsp;case I have the alternate value of string.empty for nullable string fields. By using these new options if the form control for the column is 'blanked out' then Null is saved to the database rather than "".&lt;/P&gt;&lt;P&gt;Cheers, Peter</description><pubDate>Tue, 24 Apr 2007 18:14:50 GMT</pubDate><dc:creator>Peter Jones</dc:creator></item></channel></rss>