You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by gb...@apache.org on 2006/11/14 19:33:16 UTC
svn commit: r474910 - in /ibatis/trunk/cs/mapper: IBatisNet.DataMapper.Test/
IBatisNet.DataMapper.Test/Domain/
IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/
IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Generics/
IBatisNet.DataMapper.Test/Scripts/MSSQL...
Author: gbayon
Date: Tue Nov 14 10:33:12 2006
New Revision: 474910
URL: http://svn.apache.org/viewvc?view=rev&rev=474910
Log:
- Fix for IBATISNET-189 Missing Typehandler for nullable timespan
+ make public all typehandler
Added:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/VarcharCallBack.cs (with props)
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableTimeSpanTypeHandler.cs (with props)
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Nullable.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.2005.csproj
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Nullable.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Generics/NullableTest.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/Nullable-init.sql
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/BaseTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/BooleanTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/ByteArrayTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/ByteTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/CharTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/CustomTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DBNullTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DateTimeTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DecimalTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DoubleTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/EnumTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/GuidTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Int16TypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Int32TypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Int64TypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableBooleanTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableByteTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableCharTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableDateTimeTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableDecimalTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableDoubleTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableGuidTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableInt16TypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableInt32TypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableInt64TypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableSByteTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableSingleTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt16TypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt32TypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt64TypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/ObjectTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/SByteTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/SingleTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/StringTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TimeSpanTypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TypeHandlerFactory.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt16TypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt32TypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt64TypeHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UnknownTypeHandler.cs
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Nullable.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Nullable.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Nullable.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Nullable.cs Tue Nov 14 10:33:12 2006
@@ -26,10 +26,17 @@
private Int32? _testInt32 = null;
private Int64? _testInt64 = null;
private Single? _testSingle = null;
+ private TimeSpan? _testTimeSpan = null;
public NullableClass(Int32? id)
{
_testInt32 = id;
+ }
+
+ public TimeSpan? TestTimeSpan
+ {
+ get { return _testTimeSpan; }
+ set { _testTimeSpan = value; }
}
public int Id
Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/VarcharCallBack.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/VarcharCallBack.cs?view=auto&rev=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/VarcharCallBack.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/VarcharCallBack.cs Tue Nov 14 10:33:12 2006
@@ -0,0 +1,9 @@
+using System;
+using System.Data;
+using System.Data.SqlClient;
+using IBatisNet.DataMapper.TypeHandlers;
+
+namespace IBatisNet.DataMapper.Test.Domain
+{
+
+}
Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/VarcharCallBack.cs
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/VarcharCallBack.cs
------------------------------------------------------------------------------
svn:keywords = Id LastChangedDate LastChangedBy
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.2005.csproj
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.2005.csproj?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.2005.csproj (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.2005.csproj Tue Nov 14 10:33:12 2006
@@ -192,6 +192,7 @@
<Compile Include="Domain\User.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="Domain\VarcharCallBack.cs" />
<Compile Include="NUnit\SqlMapTests\BaseTest.cs">
<SubType>Code</SubType>
</Compile>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Nullable.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Nullable.xml?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Nullable.xml (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Nullable.xml Tue Nov 14 10:33:12 2006
@@ -39,6 +39,7 @@
<result property="TestInt32" column="TestInt32"/>
<result property="TestInt64" column="TestInt64"/>
<result property="TestSingle" column="TestSingle" />
+ <result property="TestTimeSpan" column="TestTimeSpan" />
</resultMap>
</resultMaps >
@@ -71,9 +72,9 @@
select SCOPE_IDENTITY() as value
</selectKey>
insert into Nullable
- (TestBool, TestByte, TestChar, TestDateTime, TestDecimal, TestDouble, TestGuid, TestInt16, TestInt32, TestInt64, TestSingle)
+ (TestBool, TestByte, TestChar, TestDateTime, TestDecimal, TestDouble, TestGuid, TestInt16, TestInt32, TestInt64, TestSingle, TestTimeSpan)
values
- (#TestBool#, #TestByte#, #TestChar#, #TestDateTime#, #TestDecimal#, #TestDouble#, #TestGuid#, #TestInt16#, #TestInt32#, #TestInt64#, #TestSingle#)
+ (#TestBool#, #TestByte#, #TestChar#, #TestDateTime#, #TestDecimal#, #TestDouble#, #TestGuid#, #TestInt16#, #TestInt32#, #TestInt64#, #TestSingle#, #TestTimeSpan#)
</insert>
</statements>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Generics/NullableTest.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Generics/NullableTest.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Generics/NullableTest.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Generics/NullableTest.cs Tue Nov 14 10:33:12 2006
@@ -511,6 +511,42 @@
Assert.AreEqual(4578.46445454112f, clazz.TestSingle);
}
#endregion
+
+ #region timespan
+
+ [Test]
+ public void TestNullableTimeSpan()
+ {
+ NullableClass clazz = new NullableClass();
+ sqlMap.Insert("InsertNullable", clazz);
+ clazz = null;
+ clazz = sqlMap.QueryForObject<NullableClass>("GetNullable", 1);
+
+ Assert.IsNotNull(clazz);
+ Assert.AreEqual(1, clazz.Id);
+ Assert.IsNull(clazz.TestTimeSpan);
+ }
+
+ /// <summary>
+ /// Test not nullable timespan
+ /// </summary>
+ [Test]
+ public void TestNotNullableTimeSpan()
+ {
+ NullableClass clazz = new NullableClass();
+ TimeSpan? span = new TimeSpan?(new TimeSpan(1, 2, 3, 4, 5));
+ clazz.TestTimeSpan = span;
+
+ sqlMap.Insert("InsertNullable", clazz);
+ clazz = null;
+ clazz = sqlMap.QueryForObject<NullableClass>("GetNullable", 1);
+
+ Assert.IsNotNull(clazz);
+ Assert.AreEqual(1, clazz.Id);
+ Assert.AreEqual(span.Value.ToString(), clazz.TestTimeSpan.Value.ToString());
+ }
+
+ #endregion
}
}
#endif
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/Nullable-init.sql
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/Nullable-init.sql?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/Nullable-init.sql (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/Nullable-init.sql Tue Nov 14 10:33:12 2006
@@ -18,6 +18,7 @@
[TestInt32] [int] NULL ,
[TestInt64] [bigint] NULL ,
[TestSingle] [real] NULL ,
+ [TestTimeSpan] [bigint] NULL,
CONSTRAINT [PK_Nullable] PRIMARY KEY CLUSTERED
(
[Id]
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj Tue Nov 14 10:33:12 2006
@@ -634,6 +634,7 @@
<Compile Include="TypeHandlers\Nullables\NullableInt64TypeHandler.cs" />
<Compile Include="TypeHandlers\Nullables\NullableSByteTypeHandler.cs" />
<Compile Include="TypeHandlers\Nullables\NullableSingleTypeHandler.cs" />
+ <Compile Include="TypeHandlers\Nullables\NullableTimeSpanTypeHandler.cs" />
<Compile Include="TypeHandlers\Nullables\NullableUInt16TypeHandler.cs" />
<Compile Include="TypeHandlers\Nullables\NullableUInt32TypeHandler.cs" />
<Compile Include="TypeHandlers\Nullables\NullableUInt64TypeHandler.cs" />
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/BaseTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/BaseTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/BaseTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/BaseTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -37,7 +37,7 @@
/// <summary>
/// Summary description for BaseTypeHandler.
/// </summary>
- internal abstract class BaseTypeHandler : ITypeHandler
+ public abstract class BaseTypeHandler : ITypeHandler
{
/// <summary>
/// Gets a column value by the name
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/BooleanTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/BooleanTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/BooleanTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/BooleanTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -39,7 +39,7 @@
/// <summary>
/// Boolean TypeHandler.
/// </summary>
- internal sealed class BooleanTypeHandler : BaseTypeHandler
+ public sealed class BooleanTypeHandler : BaseTypeHandler
{
/// <summary>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/ByteArrayTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/ByteArrayTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/ByteArrayTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/ByteArrayTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -39,7 +39,7 @@
/// <summary>
/// Description résumée de ByteArrayTypeHandler.
/// </summary>
- internal sealed class ByteArrayTypeHandler : BaseTypeHandler
+ public sealed class ByteArrayTypeHandler : BaseTypeHandler
{
/// <summary>
///
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/ByteTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/ByteTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/ByteTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/ByteTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -39,7 +39,7 @@
/// <summary>
/// Description résumée de ByteTypeHandler.
/// </summary>
- internal sealed class ByteTypeHandler : BaseTypeHandler
+ public sealed class ByteTypeHandler : BaseTypeHandler
{
/// <summary>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/CharTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/CharTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/CharTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/CharTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -38,7 +38,7 @@
/// <summary>
/// Description résumée de CharTypeHandler.
/// </summary>
- internal sealed class CharTypeHandler : BaseTypeHandler
+ public sealed class CharTypeHandler : BaseTypeHandler
{
/// <summary>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/CustomTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/CustomTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/CustomTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/CustomTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -36,7 +36,7 @@
/// <summary>
/// Custom type handler for adding a TypeHandlerCallback
/// </summary>
- internal sealed class CustomTypeHandler : BaseTypeHandler
+ public sealed class CustomTypeHandler : BaseTypeHandler
{
private ITypeHandlerCallback _callback = null;
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DBNullTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DBNullTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DBNullTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DBNullTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -38,18 +38,36 @@
/// <summary>
/// DBNull TypeHandler.
/// </summary>
- internal sealed class DBNullTypeHandler : BaseTypeHandler
+ public sealed class DBNullTypeHandler : BaseTypeHandler
{
+ /// <summary>
+ /// Gets a column value by the name
+ /// </summary>
+ /// <param name="mapping"></param>
+ /// <param name="dataReader"></param>
+ /// <returns></returns>
public override object GetValueByName(ResultProperty mapping, IDataReader dataReader)
{
return DBNull.Value;
}
+ /// <summary>
+ /// Gets a column value by the index
+ /// </summary>
+ /// <param name="mapping"></param>
+ /// <param name="dataReader"></param>
+ /// <returns></returns>
public override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
{
return DBNull.Value;
}
+ /// <summary>
+ /// Retrieve ouput database value of an output parameter
+ /// </summary>
+ /// <param name="outputValue">ouput database value</param>
+ /// <param name="parameterType">type used in EnumTypeHandler</param>
+ /// <returns></returns>
public override object GetDataBaseValue(object outputValue, Type parameterType )
{
return DBNull.Value;
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DateTimeTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DateTimeTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DateTimeTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DateTimeTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -38,7 +38,7 @@
/// <summary>
/// Description résumée de DateTimeTypeHandler.
/// </summary>
- internal sealed class DateTimeTypeHandler : BaseTypeHandler
+ public sealed class DateTimeTypeHandler : BaseTypeHandler
{
/// <summary>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DecimalTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DecimalTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DecimalTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DecimalTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -38,7 +38,7 @@
/// <summary>
/// DecimalTypeHandler.
/// </summary>
- internal sealed class DecimalTypeHandler : BaseTypeHandler
+ public sealed class DecimalTypeHandler : BaseTypeHandler
{
/// <summary>
///
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DoubleTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DoubleTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DoubleTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/DoubleTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -38,7 +38,7 @@
/// <summary>
/// Description résumée de Double.
/// </summary>
- internal sealed class DoubleTypeHandler : BaseTypeHandler
+ public sealed class DoubleTypeHandler : BaseTypeHandler
{
/// <summary>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/EnumTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/EnumTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/EnumTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/EnumTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -37,7 +37,7 @@
/// <summary>
/// Summary description for EnumTypeHandler.
/// </summary>
- internal sealed class EnumTypeHandler : BaseTypeHandler
+ public sealed class EnumTypeHandler : BaseTypeHandler
{
/// <summary>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/GuidTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/GuidTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/GuidTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/GuidTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -38,7 +38,7 @@
/// <summary>
/// Description résumée de GuidTypeHandler.
/// </summary>
- internal sealed class GuidTypeHandler : BaseTypeHandler
+ public sealed class GuidTypeHandler : BaseTypeHandler
{
/// <summary>
///
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Int16TypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Int16TypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Int16TypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Int16TypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -37,7 +37,7 @@
/// <summary>
/// Description résumée de Int16TypeHandler.
/// </summary>
- internal sealed class Int16TypeHandler : BaseTypeHandler
+ public sealed class Int16TypeHandler : BaseTypeHandler
{
/// <summary>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Int32TypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Int32TypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Int32TypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Int32TypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -38,7 +38,7 @@
/// <summary>
/// Summary description for Int32TypeHandler.
/// </summary>
- internal sealed class Int32TypeHandler : BaseTypeHandler
+ public sealed class Int32TypeHandler : BaseTypeHandler
{
/// <summary>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Int64TypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Int64TypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Int64TypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Int64TypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -38,7 +38,7 @@
/// <summary>
/// Description résumée de Int64TypeHandler.
/// </summary>
- internal sealed class Int64TypeHandler : BaseTypeHandler
+ public sealed class Int64TypeHandler : BaseTypeHandler
{
/// <summary>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableBooleanTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableBooleanTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableBooleanTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableBooleanTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -35,7 +35,7 @@
namespace IBatisNet.DataMapper.TypeHandlers.Nullables
{
- internal class NullableBooleanTypeHandler : BaseTypeHandler
+ public sealed class NullableBooleanTypeHandler : BaseTypeHandler
{
public override void SetParameter(IDataParameter dataParameter, object parameterValue, string dbType)
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableByteTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableByteTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableByteTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableByteTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -35,7 +35,7 @@
namespace IBatisNet.DataMapper.TypeHandlers.Nullables
{
- class NullableByteTypeHandler : BaseTypeHandler
+ public sealed class NullableByteTypeHandler : BaseTypeHandler
{
public override void SetParameter(IDataParameter dataParameter, object parameterValue, string dbType)
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableCharTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableCharTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableCharTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableCharTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -35,7 +35,7 @@
namespace IBatisNet.DataMapper.TypeHandlers.Nullables
{
- internal class NullableCharTypeHandler : BaseTypeHandler
+ public sealed class NullableCharTypeHandler : BaseTypeHandler
{
public override void SetParameter(IDataParameter dataParameter, object parameterValue, string dbType)
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableDateTimeTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableDateTimeTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableDateTimeTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableDateTimeTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -27,17 +27,24 @@
#region Using
using System;
using System.Data;
-
-using System.Collections.Generic;
-using IBatisNet.DataMapper.Configuration.ParameterMapping;
using IBatisNet.DataMapper.Configuration.ResultMapping;
#endregion
namespace IBatisNet.DataMapper.TypeHandlers.Nullables
{
- internal class NullableDateTimeTypeHandler : BaseTypeHandler
+ /// <summary>
+ ///
+ /// </summary>
+ /// <remarks>System.TimeSpan is map to DbType.Int64 </remarks>
+ public sealed class NullableDateTimeTypeHandler : BaseTypeHandler
{
+ /// <summary>
+ /// Sets a parameter on a IDbCommand
+ /// </summary>
+ /// <param name="dataParameter">the parameter</param>
+ /// <param name="parameterValue">the parameter value</param>
+ /// <param name="dbType">the dbType of the parameter</param>
public override void SetParameter(IDataParameter dataParameter, object parameterValue, string dbType)
{
DateTime? nullableValue = (DateTime?)parameterValue;
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableDecimalTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableDecimalTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableDecimalTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableDecimalTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -36,10 +36,16 @@
namespace IBatisNet.DataMapper.TypeHandlers.Nullables
{
- internal class NullableDecimalTypeHandler : BaseTypeHandler
+ public class NullableDecimalTypeHandler : BaseTypeHandler
{
- public override void SetParameter(IDataParameter dataParameter, object parameterValue, string dbType)
+ /// <summary>
+ /// Sets a parameter on a IDbCommand
+ /// </summary>
+ /// <param name="dataParameter">the parameter</param>
+ /// <param name="parameterValue">the parameter value</param>
+ /// <param name="dbType">the dbType of the parameter</param>
+ public sealed override void SetParameter(IDataParameter dataParameter, object parameterValue, string dbType)
{
decimal? nullableValue = (decimal?)parameterValue;
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableDoubleTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableDoubleTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableDoubleTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableDoubleTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -35,9 +35,15 @@
namespace IBatisNet.DataMapper.TypeHandlers.Nullables
{
- internal class NullableDoubleTypeHandler : BaseTypeHandler
+ public sealed class NullableDoubleTypeHandler : BaseTypeHandler
{
+ /// <summary>
+ /// Sets a parameter on a IDbCommand
+ /// </summary>
+ /// <param name="dataParameter">the parameter</param>
+ /// <param name="parameterValue">the parameter value</param>
+ /// <param name="dbType">the dbType of the parameter</param>
public override void SetParameter(IDataParameter dataParameter, object parameterValue, string dbType)
{
double? nullableValue = (double?)parameterValue;
@@ -52,8 +58,9 @@
}
}
+
/// <summary>
- ///
+ /// Gets a column value by the name
/// </summary>
/// <param name="mapping"></param>
/// <param name="dataReader"></param>
@@ -72,6 +79,12 @@
}
}
+ /// <summary>
+ /// Gets a column value by the index
+ /// </summary>
+ /// <param name="mapping"></param>
+ /// <param name="dataReader"></param>
+ /// <returns></returns>
public override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
{
if (dataReader.IsDBNull(mapping.ColumnIndex) == true)
@@ -84,23 +97,45 @@
}
}
+ /// <summary>
+ /// Retrieve ouput database value of an output parameter
+ /// </summary>
+ /// <param name="outputValue">ouput database value</param>
+ /// <param name="parameterType">type used in EnumTypeHandler</param>
+ /// <returns></returns>
public override object GetDataBaseValue(object outputValue, Type parameterType)
{
return new double?(Convert.ToDouble(outputValue));
}
+ /// <summary>
+ /// Converts the String to the type that this handler deals with
+ /// </summary>
+ /// <param name="type">the tyepe of the property (used only for enum conversion)</param>
+ /// <param name="s">the String value</param>
+ /// <returns>the converted value</returns>
public override object ValueOf(Type type, string s)
{
return new double?(Convert.ToDouble(s));
}
+ /// <summary>
+ /// Gets a value indicating whether this instance is simple type.
+ /// </summary>
+ /// <value>
+ /// <c>true</c> if this instance is simple type; otherwise, <c>false</c>.
+ /// </value>
public override bool IsSimpleType
{
get { return true; }
}
+ /// <summary>
+ /// The null value for this type
+ /// </summary>
+ /// <value></value>
public override object NullValue
{
get { return new double?(); }
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableGuidTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableGuidTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableGuidTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableGuidTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -35,7 +35,7 @@
namespace IBatisNet.DataMapper.TypeHandlers.Nullables
{
- internal class NullableGuidTypeHandler : BaseTypeHandler
+ public sealed class NullableGuidTypeHandler : BaseTypeHandler
{
public override void SetParameter(IDataParameter dataParameter, object parameterValue, string dbType)
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableInt16TypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableInt16TypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableInt16TypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableInt16TypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -35,7 +35,7 @@
namespace IBatisNet.DataMapper.TypeHandlers.Nullables
{
- internal class NullableInt16TypeHandler : BaseTypeHandler
+ public sealed class NullableInt16TypeHandler : BaseTypeHandler
{
public override void SetParameter(IDataParameter dataParameter, object parameterValue, string dbType)
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableInt32TypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableInt32TypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableInt32TypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableInt32TypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -38,7 +38,7 @@
/// <summary>
/// Summary description for Int32TypeHandler.
/// </summary>
- internal class NullableInt32TypeHandler : BaseTypeHandler
+ public sealed class NullableInt32TypeHandler : BaseTypeHandler
{
public override void SetParameter(IDataParameter dataParameter, object parameterValue, string dbType)
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableInt64TypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableInt64TypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableInt64TypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableInt64TypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -35,7 +35,7 @@
namespace IBatisNet.DataMapper.TypeHandlers.Nullables
{
- internal class NullableInt64TypeHandler : BaseTypeHandler
+ public sealed class NullableInt64TypeHandler : BaseTypeHandler
{
/// <summary>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableSByteTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableSByteTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableSByteTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableSByteTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -35,7 +35,7 @@
namespace IBatisNet.DataMapper.TypeHandlers.Nullables
{
- class NullableSByteTypeHandler : BaseTypeHandler
+ public sealed class NullableSByteTypeHandler : BaseTypeHandler
{
public override void SetParameter(IDataParameter dataParameter, object parameterValue, string dbType)
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableSingleTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableSingleTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableSingleTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableSingleTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -35,7 +35,7 @@
namespace IBatisNet.DataMapper.TypeHandlers.Nullables
{
- internal class NullableSingleTypeHandler : BaseTypeHandler
+ public sealed class NullableSingleTypeHandler : BaseTypeHandler
{
public override void SetParameter(IDataParameter dataParameter, object parameterValue, string dbType)
Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableTimeSpanTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableTimeSpanTypeHandler.cs?view=auto&rev=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableTimeSpanTypeHandler.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableTimeSpanTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -0,0 +1,144 @@
+#region Apache Notice
+/*****************************************************************************
+ * $Revision: 378879 $
+ * $LastChangedDate$
+ * $LastChangedBy$
+ *
+ * iBATIS.NET Data Mapper
+ * Copyright (C) 2006/2005 - The Apache Software Foundation
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ********************************************************************************/
+#endregion
+
+#if dotnet2
+#region Using
+using System;
+using System.Data;
+using IBatisNet.DataMapper.Configuration.ResultMapping;
+#endregion
+
+namespace IBatisNet.DataMapper.TypeHandlers.Nullables
+{
+ public sealed class NullableTimeSpanTypeHandler : BaseTypeHandler
+ {
+
+ /// <summary>
+ /// Sets a parameter on a IDbCommand
+ /// </summary>
+ /// <param name="dataParameter">the parameter</param>
+ /// <param name="parameterValue">the parameter value</param>
+ /// <param name="dbType">the dbType of the parameter</param>
+ public override void SetParameter(IDataParameter dataParameter, object parameterValue, string dbType)
+ {
+ TimeSpan? nullableValue = (TimeSpan?)parameterValue;
+
+ if (nullableValue.HasValue)
+ {
+ dataParameter.Value = nullableValue.Value;
+ }
+ else
+ {
+ dataParameter.Value = DBNull.Value;
+ }
+ }
+
+
+ /// <summary>
+ /// Gets a column value by the name
+ /// </summary>
+ /// <param name="mapping"></param>
+ /// <param name="dataReader"></param>
+ /// <returns></returns>
+ public override object GetValueByName(ResultProperty mapping, IDataReader dataReader)
+ {
+ int index = dataReader.GetOrdinal(mapping.ColumnName);
+
+ if (dataReader.IsDBNull(index) == true)
+ {
+ return DBNull.Value;
+ }
+ else
+ {
+ return new TimeSpan?(new TimeSpan(Convert.ToInt64(dataReader.GetValue(index))));
+ }
+ }
+
+
+ /// <summary>
+ /// Gets a column value by the index
+ /// </summary>
+ /// <param name="mapping"></param>
+ /// <param name="dataReader"></param>
+ /// <returns></returns>
+ public override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
+ {
+ if (dataReader.IsDBNull(mapping.ColumnIndex) == true)
+ {
+ return DBNull.Value;
+ }
+ else
+ {
+ return new TimeSpan?(new TimeSpan(Convert.ToInt64(dataReader.GetValue(mapping.ColumnIndex))));
+ }
+ }
+
+ /// <summary>
+ /// Retrieve ouput database value of an output parameter
+ /// </summary>
+ /// <param name="outputValue">ouput database value</param>
+ /// <param name="parameterType">type used in EnumTypeHandler</param>
+ /// <returns></returns>
+ public override object GetDataBaseValue(object outputValue, Type parameterType)
+ {
+
+ return new TimeSpan?(new TimeSpan(Convert.ToInt64(outputValue)));
+ }
+
+ /// <summary>
+ /// Converts the String to the type that this handler deals with
+ /// </summary>
+ /// <param name="type">the tyepe of the property (used only for enum conversion)</param>
+ /// <param name="s">the String value</param>
+ /// <returns>the converted value</returns>
+ public override object ValueOf(Type type, string s)
+ {
+ return new TimeSpan?(TimeSpan.Parse(s));
+ }
+
+
+ /// <summary>
+ /// Gets a value indicating whether this instance is simple type.
+ /// </summary>
+ /// <value>
+ /// <c>true</c> if this instance is simple type; otherwise, <c>false</c>.
+ /// </value>
+ public override bool IsSimpleType
+ {
+ get { return true; }
+ }
+
+ /// <summary>
+ /// The null value for this type
+ /// </summary>
+ /// <value></value>
+ public override object NullValue
+ {
+ get { return new TimeSpan?(); }
+ }
+ }
+}
+
+#endif
\ No newline at end of file
Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableTimeSpanTypeHandler.cs
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableTimeSpanTypeHandler.cs
------------------------------------------------------------------------------
svn:keywords = Id LastChangedDate LastChangedBy
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt16TypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt16TypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt16TypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt16TypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -36,7 +36,7 @@
namespace IBatisNet.DataMapper.TypeHandlers.Nullables
{
- internal class NullableUInt16TypeHandler : BaseTypeHandler
+ public sealed class NullableUInt16TypeHandler : BaseTypeHandler
{
/// <summary>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt32TypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt32TypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt32TypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt32TypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -39,7 +39,7 @@
/// <summary>
/// Summary description for Int32TypeHandler.
/// </summary>
- internal class NullableUInt32TypeHandler : BaseTypeHandler
+ public sealed class NullableUInt32TypeHandler : BaseTypeHandler
{
public override void SetParameter(IDataParameter dataParameter, object parameterValue, string dbType)
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt64TypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt64TypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt64TypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/Nullables/NullableUInt64TypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -35,7 +35,7 @@
namespace IBatisNet.DataMapper.TypeHandlers.Nullables
{
- internal class NullableUInt64TypeHandler : BaseTypeHandler
+ public sealed class NullableUInt64TypeHandler : BaseTypeHandler
{
/// <summary>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/ObjectTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/ObjectTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/ObjectTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/ObjectTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -38,7 +38,7 @@
/// <summary>
/// Description résumée de ObjectTypeHandler.
/// </summary>
- internal sealed class ObjectTypeHandler : BaseTypeHandler
+ public sealed class ObjectTypeHandler : BaseTypeHandler
{
/// <summary>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/SByteTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/SByteTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/SByteTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/SByteTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -39,7 +39,7 @@
/// <summary>
/// SByteTypeHandler.
/// </summary>
- internal sealed class SByteTypeHandler : BaseTypeHandler
+ public sealed class SByteTypeHandler : BaseTypeHandler
{
/// <summary>
/// Gets a column value by the name
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/SingleTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/SingleTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/SingleTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/SingleTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -38,7 +38,7 @@
/// <summary>
/// Description résumée de SingleTypeHandler.
/// </summary>
- internal sealed class SingleTypeHandler : BaseTypeHandler
+ public sealed class SingleTypeHandler : BaseTypeHandler
{
/// <summary>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/StringTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/StringTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/StringTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/StringTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -38,7 +38,7 @@
/// <summary>
/// Description résumée de SByteTypeHandler.
/// </summary>
- internal sealed class StringTypeHandler : BaseTypeHandler
+ public sealed class StringTypeHandler : BaseTypeHandler
{
/// <summary>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TimeSpanTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TimeSpanTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TimeSpanTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TimeSpanTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -38,7 +38,7 @@
/// <summary>
/// Description résumée de TimespanTypeHandler.
/// </summary>
- internal sealed class TimeSpanTypeHandler : BaseTypeHandler
+ public sealed class TimeSpanTypeHandler : BaseTypeHandler
{
/// <summary>
@@ -52,12 +52,13 @@
dataParameter.Value = ((TimeSpan)parameterValue).Ticks;
}
- /// <summary>
- ///
- /// </summary>
- /// <param name="mapping"></param>
- /// <param name="dataReader"></param>
- /// <returns></returns>
+
+ /// <summary>
+ /// Gets a column value by the name
+ /// </summary>
+ /// <param name="mapping"></param>
+ /// <param name="dataReader"></param>
+ /// <returns></returns>
public override object GetValueByName(ResultProperty mapping, IDataReader dataReader)
{
int index = dataReader.GetOrdinal(mapping.ColumnName);
@@ -72,12 +73,13 @@
}
}
- /// <summary>
- ///
- /// </summary>
- /// <param name="mapping"></param>
- /// <param name="dataReader"></param>
- /// <returns></returns>
+
+ /// <summary>
+ /// Gets a column value by the index
+ /// </summary>
+ /// <param name="mapping"></param>
+ /// <param name="dataReader"></param>
+ /// <returns></returns>
public override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
{
if (dataReader.IsDBNull(mapping.ColumnIndex) == true)
@@ -90,14 +92,26 @@
}
}
+ /// <summary>
+ /// Retrieve ouput database value of an output parameter
+ /// </summary>
+ /// <param name="outputValue">ouput database value</param>
+ /// <param name="parameterType">type used in EnumTypeHandler</param>
+ /// <returns></returns>
public override object GetDataBaseValue(object outputValue, Type parameterType )
{
return new TimeSpan(Convert.ToInt64(outputValue));
}
+ /// <summary>
+ /// Converts the String to the type that this handler deals with
+ /// </summary>
+ /// <param name="type">the tyepe of the property (used only for enum conversion)</param>
+ /// <param name="s">the String value</param>
+ /// <returns>the converted value</returns>
public override object ValueOf(Type type, string s)
{
- return new TimeSpan(Convert.ToInt64(s));
+ return TimeSpan.Parse(s);
}
/// <summary>
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TypeHandlerFactory.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TypeHandlerFactory.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TypeHandlerFactory.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TypeHandlerFactory.cs Tue Nov 14 10:33:12 2006
@@ -174,6 +174,10 @@
handler = new NullableSByteTypeHandler();
this.Register(typeof(SByte?), handler);
+
+ handler = new NullableTimeSpanTypeHandler();
+ this.Register(typeof(TimeSpan?), handler);
+
#endif
_unknownTypeHandler = new UnknownTypeHandler(this);
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt16TypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt16TypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt16TypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt16TypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -34,7 +34,7 @@
namespace IBatisNet.DataMapper.TypeHandlers
{
- internal sealed class UInt16TypeHandler : BaseTypeHandler
+ public sealed class UInt16TypeHandler : BaseTypeHandler
{
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt32TypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt32TypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt32TypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt32TypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -37,7 +37,7 @@
/// <summary>
/// UInt32TypeHandler
/// </summary>
- internal sealed class UInt32TypeHandler : BaseTypeHandler
+ public sealed class UInt32TypeHandler : BaseTypeHandler
{
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt64TypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt64TypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt64TypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UInt64TypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -38,7 +38,7 @@
/// <summary>
/// Summary description for UInt64TypeHandler.
/// </summary>
- internal sealed class UInt64TypeHandler : BaseTypeHandler
+ public sealed class UInt64TypeHandler : BaseTypeHandler
{
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UnknownTypeHandler.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UnknownTypeHandler.cs?view=diff&rev=474910&r1=474909&r2=474910
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UnknownTypeHandler.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/UnknownTypeHandler.cs Tue Nov 14 10:33:12 2006
@@ -37,7 +37,7 @@
/// <summary>
/// Implementation of TypeHandler for dealing with unknown types
/// </summary>
- internal sealed class UnknownTypeHandler : BaseTypeHandler
+ public sealed class UnknownTypeHandler : BaseTypeHandler
{
private TypeHandlerFactory _factory = null;