You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Gilles Bayon (JIRA)" <ib...@incubator.apache.org> on 2006/01/04 18:39:01 UTC

[jira] Closed: (IBATISNET-109) Allow use of built-in magic numbers (int.MinValue, DateTime.MaxValue) for nullValues with nullValueTypeProperty

     [ http://issues.apache.org/jira/browse/IBATISNET-109?page=all ]
     
Gilles Bayon closed IBATISNET-109:
----------------------------------

    Assign To: Ron Grabowski

> Allow use of built-in magic numbers (int.MinValue, DateTime.MaxValue) for nullValues with nullValueTypeProperty
> ---------------------------------------------------------------------------------------------------------------
>
>          Key: IBATISNET-109
>          URL: http://issues.apache.org/jira/browse/IBATISNET-109
>      Project: iBatis for .NET
>         Type: Improvement
>     Reporter: Ron Grabowski
>     Assignee: Ron Grabowski
>     Priority: Trivial

>
> Instead of having to specify a known value for a nullValue:
>  <parameter property="EmailAddress" type="string" nullValue="no_email@provided.com" column="EMAIL" />
> It would be nice to use the magic values built into the Framework:
>  string.Empty
>  int.MinValue
>  int.MaxValue
>  DateTime.MinValue
>  DateTime.MaxValue
>  etc...
> Using syntax like this means I don't have to embed the magic string "no_email@provided.com" into my application:
> <parameter property="EmailAddress" type="string" nullValueTypeProperty="Empty" column="EMAIL" />
> int.MinValue is a static const and DateTime.MinValue is a static readonly so I don't know if property would be the correct wording. Is there a more general term for properties, fields, public constants, etc?
>  <parameter property="EmailAddress" type="string" nullValueTypeMember="Empty" column="EMAIL" />
> nullValueTypeMember should be shorter too...
> An alternative approach (I like this idea more)  would be to ship IBatisNet with things like:
>  StringEmptyNullValueTypeHandler
>  DateTimeMaxValueNullValueTypeHandler
>  DateTimeMinValueNullValueTypeHandler
>  Int32MinValueNullValueTypeHandler
>  Int32MaxValueNullValueTypeHandler
> They would have a dual purpose of inserting a null value when a string.Empty or an int.MinValue were encountered as well as setting a property to string.Empty or int.MinValue when a NULL is returned from the database.
>  <!-- insert NULL if EmailAddress is the empty string -->
>  <parameter property="EmailAddress" column="EMAIL_ADDRESS" handler="StringEmptyNullValueTypeHandler" />
>  <!-- set ExpirationDate to DateTime.MaxValue if the database returns NULL -->
>  <result property="ExpirationDate" column="EXPIRATION_DATE" handler="DateTimeMaxValueNullValueTypeHandler" />

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira