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 Priority: Trivial Instead of having to specify a known value for a nullValue: <parameter property="EmailAddress" type="string" nullValue="[EMAIL PROTECTED]" 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 "[EMAIL PROTECTED]" 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