Author: gbayon
Date: Tue May 23 13:42:23 2006
New Revision: 409004

URL: http://svn.apache.org/viewvc?rev=409004&view=rev
Log:
- Added support for nullable type on resultClass attribute of statement tag

Modified:
    ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/TypeUtils.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Nullable.cs
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Complex.xml
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/BaseTest.cs
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ComplexTypeTest.cs
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConfigureTest.cs
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements/Statement.cs
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/DataExchange/ComplexDataExchange.cs
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/ResultClassStrategy.cs

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/TypeUtils.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/TypeUtils.cs?rev=409004&r1=409003&r2=409004&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/TypeUtils.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/TypeUtils.cs Tue May 23 
13:42:23 2006
@@ -146,5 +146,76 @@
             }
             return resultObject;
         }
+
+#if dotnet2
+        /// <summary>
+        /// Instantiate a Nullable Type.
+        /// </summary>
+        /// <param name="type">The nullable type.</param>
+        /// <returns>An object.</returns>
+        public static object InstantiateNullableType(Type type)
+        {
+            object resultObject = null;
+
+            if (type== typeof(bool?))
+            {
+                resultObject = new Nullable<bool>(false);
+            }
+            else if (type== typeof(byte?))
+            {
+                resultObject = new Nullable<byte>(byte.MinValue);
+            }               
+            else if (type== typeof(char?))
+            {
+                resultObject = new Nullable<char>(char.MinValue);
+            }
+            else if (type == typeof(DateTime?))
+            {
+                resultObject = new Nullable<DateTime>(DateTime.MinValue);
+            }
+            else if (type == typeof(decimal?))
+            {
+                resultObject = new Nullable<decimal>(decimal.MinValue);
+            }
+            else if (type == typeof(double?))
+            {
+                resultObject = new Nullable<double>(double.MinValue);
+            }
+            else if (type == typeof(Int16?))
+            {
+                resultObject = new Nullable<Int16>(Int16.MinValue);
+            }
+            else if (type == typeof(Int32?))
+            {
+                resultObject = new Nullable<Int32>(Int32.MinValue);
+            }
+            else if (type == typeof(Int64?))
+            {
+                resultObject = new Nullable<Int64>(Int64.MinValue);
+            }
+            else if (type == typeof(SByte?))
+            {
+                resultObject = new Nullable<SByte>(SByte.MinValue);
+            }
+            else if (type == typeof(Single?))
+            {
+                resultObject = new Nullable<Single>(Single.MinValue);
+            }
+            else if (type == typeof(UInt16?))
+            {
+                resultObject = new Nullable<UInt16>(UInt16.MinValue);
+            }
+            else if (type == typeof(UInt32?))
+            {
+                resultObject = new Nullable<UInt32>(UInt32.MinValue);
+            }
+            else if (type == typeof(UInt64?))
+            {
+                resultObject = new Nullable<UInt64>(UInt64.MinValue);
+            }              
+
+            return resultObject;
+        }
+#endif
     }
 }

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?rev=409004&r1=409003&r2=409004&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Nullable.cs 
(original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Nullable.cs Tue May 
23 13:42:23 2006
@@ -2,7 +2,7 @@
 #if dotnet2
 using System.Collections.Generic;
 #endif
-using System.Text;
+
 
 namespace IBatisNet.DataMapper.Test.Domain
 {

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Complex.xml
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Complex.xml?rev=409004&r1=409003&r2=409004&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Complex.xml
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Complex.xml
 Tue May 23 13:42:23 2006
@@ -6,7 +6,7 @@
        <statements>
        
                <statement id="ComplexMap"
-                       resultClass="int" >
+                       resultClass="${nullableInt}" >
                        select Account_ID from Accounts where Account_ID = 
#obj.Map.Id#
                </statement>
                

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/BaseTest.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/BaseTest.cs?rev=409004&r1=409003&r2=409004&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/BaseTest.cs 
(original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/BaseTest.cs 
Tue May 23 13:42:23 2006
@@ -65,12 +65,14 @@
 #if dotnet2
             NameValueCollection properties = new NameValueCollection();
             
properties.Add("collection2Namespace","IBatisNet.DataMapper.Test.Domain.LineItemCollection2,
 IBatisNet.DataMapper.Test");
+            properties.Add("nullableInt", "int?");
             builder.Properties = properties;
 
             string fileName = "sqlmap" + "_" + 
ConfigurationManager.AppSettings["database"] + "_" + 
ConfigurationManager.AppSettings["providerType"] + ".config";
 #else
             NameValueCollection properties = new NameValueCollection();
             
properties.Add("collection2Namespace","IBatisNet.DataMapper.Test.Domain.LineItemCollection,
 IBatisNet.DataMapper.Test");
+            properties.Add("nullableInt", "int");
             builder.Properties = properties;
 
                        string fileName = "sqlmap" + "_" + 
ConfigurationSettings.AppSettings["database"] + "_" + 
ConfigurationSettings.AppSettings["providerType"] + ".config";

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ComplexTypeTest.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ComplexTypeTest.cs?rev=409004&r1=409003&r2=409004&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ComplexTypeTest.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ComplexTypeTest.cs
 Tue May 23 13:42:23 2006
@@ -48,7 +48,7 @@
                        obj.Map = new Hashtable();
                        obj.Map.Add("Id", 1);
                        map.Add("obj", obj);
-
+                   
                        int id = (int)sqlMap.QueryForObject("ComplexMap", map);
 
                        Assert.AreEqual(id, obj.Map["Id"]);

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConfigureTest.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConfigureTest.cs?rev=409004&r1=409003&r2=409004&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConfigureTest.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConfigureTest.cs
 Tue May 23 13:42:23 2006
@@ -14,7 +14,7 @@
        /// Description résumée de ConfigureTest.
        /// </summary>
        [TestFixture] 
-       public class ConfigureTest : BaseTest
+       public class ConfigureTest : BaseTest 
        {
                private string _fileName = string.Empty;
 
@@ -47,11 +47,12 @@
 
             NameValueCollection properties = new NameValueCollection();
             properties.Add("collection2Namespace", 
"IBatisNet.DataMapper.Test.Domain.LineItemCollection, 
IBatisNet.DataMapper.Test");
+            properties.Add("nullableInt", "int");
             builder.Properties = properties;
 
-                       SqlMapper sqlMap = builder.Configure( _fileName );
+                       SqlMapper mapper = builder.Configure( _fileName );
 
-                       Assert.IsNotNull(sqlMap);
+                       Assert.IsNotNull(mapper);
                }
 
                /// <summary>
@@ -67,11 +68,13 @@
 
             NameValueCollection properties = new NameValueCollection();
             properties.Add("collection2Namespace", 
"IBatisNet.DataMapper.Test.Domain.LineItemCollection, 
IBatisNet.DataMapper.Test");
+            properties.Add("nullableInt", "int");
+
             builder.Properties = properties;
 
-                       SqlMapper sqlMap = builder.ConfigureAndWatch( _fileName 
, handler);
+                       SqlMapper mapper = builder.ConfigureAndWatch( _fileName 
, handler);
 
-                       Assert.IsNotNull(sqlMap);
+                       Assert.IsNotNull(mapper);
                }
 
                /// <summary>
@@ -84,11 +87,13 @@
 
             NameValueCollection properties = new NameValueCollection();
             properties.Add("collection2Namespace", 
"IBatisNet.DataMapper.Test.Domain.LineItemCollection, 
IBatisNet.DataMapper.Test");
+            properties.Add("nullableInt", "int");
+
             builder.Properties = properties;
 
-                       SqlMapper sqlMap = builder.Configure( _fileName );
+                       SqlMapper mapper = builder.Configure( _fileName );
 
-                       Assert.IsNotNull(sqlMap);
+                       Assert.IsNotNull(mapper);
                }
 
                /// <summary>
@@ -103,11 +108,13 @@
 
             NameValueCollection properties = new NameValueCollection();
             properties.Add("collection2Namespace", 
"IBatisNet.DataMapper.Test.Domain.LineItemCollection, 
IBatisNet.DataMapper.Test");
+            properties.Add("nullableInt", "int");
+
             builder.Properties = properties;
 
-                       SqlMapper sqlMap = builder.ConfigureAndWatch( _fileName 
, handler);
+                       SqlMapper mapper = builder.ConfigureAndWatch( _fileName 
, handler);
 
-                       Assert.IsNotNull(sqlMap);
+                       Assert.IsNotNull(mapper);
                }
                #endregion 
 
@@ -125,11 +132,12 @@
 
             NameValueCollection properties = new NameValueCollection();
             properties.Add("collection2Namespace", 
"IBatisNet.DataMapper.Test.Domain.LineItemCollection, 
IBatisNet.DataMapper.Test");
+            properties.Add("nullableInt", "int");
             builder.Properties = properties;
 
-                       SqlMapper sqlMap = builder.Configure( _fileName );
+                       SqlMapper mapper = builder.Configure( _fileName );
 
-                       Assert.IsNotNull(sqlMap);
+                       Assert.IsNotNull(mapper);
                }
 
                /// <summary>
@@ -144,11 +152,13 @@
 
             NameValueCollection properties = new NameValueCollection();
             properties.Add("collection2Namespace", 
"IBatisNet.DataMapper.Test.Domain.LineItemCollection, 
IBatisNet.DataMapper.Test");
+            properties.Add("nullableInt", "int");
+
             builder.Properties = properties;
 
-                       SqlMapper sqlMap = builder.Configure( _fileName );
+                       SqlMapper mapper = builder.Configure( _fileName );
 
-                       Assert.IsNotNull(sqlMap);
+                       Assert.IsNotNull(mapper);
                }
 
                /// <summary>
@@ -163,13 +173,13 @@
 
             NameValueCollection properties = new NameValueCollection();
             properties.Add("collection2Namespace", 
"IBatisNet.DataMapper.Test.Domain.LineItemCollection, 
IBatisNet.DataMapper.Test");
-            builder.Properties = properties;
+            properties.Add("nullableInt", "int");
 
-                       SqlMapper sqlMap = builder.Configure( _fileName );
+            builder.Properties = properties;
 
-                       //SqlMapper sqlMap = SqlMapper.Configure( _fileName );
+                       SqlMapper mapper = builder.Configure( _fileName );
 
-                       Assert.IsNotNull(sqlMap);
+                       Assert.IsNotNull(mapper);
                }
 
                /// <summary>
@@ -184,11 +194,13 @@
 
             NameValueCollection properties = new NameValueCollection();
             properties.Add("collection2Namespace", 
"IBatisNet.DataMapper.Test.Domain.LineItemCollection, 
IBatisNet.DataMapper.Test");
+            properties.Add("nullableInt", "int");
+
             builder.Properties = properties;
 
-                       SqlMapper sqlMap = builder.Configure( _fileName );
+                       SqlMapper mapper = builder.Configure( _fileName );
 
-                       Assert.IsNotNull(sqlMap);
+                       Assert.IsNotNull(mapper);
                }
 
                /// <summary>
@@ -204,11 +216,13 @@
 
             NameValueCollection properties = new NameValueCollection();
             properties.Add("collection2Namespace", 
"IBatisNet.DataMapper.Test.Domain.LineItemCollection, 
IBatisNet.DataMapper.Test");
+            properties.Add("nullableInt", "int");
+
             builder.Properties = properties;
 
-                       SqlMapper sqlMap = builder.Configure( fileInfo );
+                       SqlMapper mapper = builder.Configure( fileInfo );
 
-                       Assert.IsNotNull(sqlMap);
+                       Assert.IsNotNull(mapper);
                }
 
                /// <summary>
@@ -224,11 +238,13 @@
 
             NameValueCollection properties = new NameValueCollection();
             properties.Add("collection2Namespace", 
"IBatisNet.DataMapper.Test.Domain.LineItemCollection, 
IBatisNet.DataMapper.Test");
+            properties.Add("nullableInt", "int");
+
             builder.Properties = properties;
 
-                       SqlMapper sqlMap = builder.Configure( uri );
+                       SqlMapper mapper = builder.Configure( uri );
 
-                       Assert.IsNotNull(sqlMap);
+                       Assert.IsNotNull(mapper);
                }
 
                /// <summary>
@@ -244,11 +260,13 @@
 
             NameValueCollection properties = new NameValueCollection();
             properties.Add("collection2Namespace", 
"IBatisNet.DataMapper.Test.Domain.LineItemCollection, 
IBatisNet.DataMapper.Test");
+            properties.Add("nullableInt", "int");
+
             builder.Properties = properties;
 
-                       SqlMapper sqlMap = builder.ConfigureAndWatch( _fileName 
, handler);
+                       SqlMapper mapper = builder.ConfigureAndWatch( _fileName 
, handler);
 
-                       Assert.IsNotNull(sqlMap);
+                       Assert.IsNotNull(mapper);
                }
 
                /// <summary>
@@ -264,11 +282,13 @@
 
             NameValueCollection properties = new NameValueCollection();
             properties.Add("collection2Namespace", 
"IBatisNet.DataMapper.Test.Domain.LineItemCollection, 
IBatisNet.DataMapper.Test");
+            properties.Add("nullableInt", "int");
+
             builder.Properties = properties;
 
-                       SqlMapper sqlMap = builder.ConfigureAndWatch( _fileName 
, handler);
+                       SqlMapper mapper = builder.ConfigureAndWatch( _fileName 
, handler);
 
-                       Assert.IsNotNull(sqlMap);
+                       Assert.IsNotNull(mapper);
                }
 
                /// <summary>
@@ -284,11 +304,13 @@
 
             NameValueCollection properties = new NameValueCollection();
             properties.Add("collection2Namespace", 
"IBatisNet.DataMapper.Test.Domain.LineItemCollection, 
IBatisNet.DataMapper.Test");
+            properties.Add("nullableInt", "int");
+
             builder.Properties = properties;
 
-            SqlMapper sqlMap = builder.ConfigureAndWatch( _fileName , handler);
+            SqlMapper mapper = builder.ConfigureAndWatch( _fileName , handler);
 
-                       Assert.IsNotNull(sqlMap);
+                       Assert.IsNotNull(mapper);
                }
 
                /// <summary>
@@ -304,11 +326,13 @@
 
             NameValueCollection properties = new NameValueCollection();
             properties.Add("collection2Namespace", 
"IBatisNet.DataMapper.Test.Domain.LineItemCollection, 
IBatisNet.DataMapper.Test");
+            properties.Add("nullableInt", "int");
+
             builder.Properties = properties;
 
-                       SqlMapper sqlMap = builder.ConfigureAndWatch( _fileName 
, handler);
+                       SqlMapper mapper = builder.ConfigureAndWatch( _fileName 
, handler);
 
-                       Assert.IsNotNull(sqlMap);
+                       Assert.IsNotNull(mapper);
                }
 
                /// <summary>
@@ -326,11 +350,13 @@
 
             NameValueCollection properties = new NameValueCollection();
             properties.Add("collection2Namespace", 
"IBatisNet.DataMapper.Test.Domain.LineItemCollection, 
IBatisNet.DataMapper.Test");
+            properties.Add("nullableInt", "int");
+
             builder.Properties = properties;
 
-                       SqlMapper sqlMap = builder.ConfigureAndWatch( fileInfo 
, handler);
+                       SqlMapper mapper = builder.ConfigureAndWatch( fileInfo 
, handler);
 
-                       Assert.IsNotNull(sqlMap);
+                       Assert.IsNotNull(mapper);
                }
                #endregion 
 
@@ -355,11 +381,13 @@
 
             NameValueCollection properties = new NameValueCollection();
             properties.Add("collection2Namespace", 
"IBatisNet.DataMapper.Test.Domain.LineItemCollection, 
IBatisNet.DataMapper.Test");
+            properties.Add("nullableInt", "int");
+
             builder.Properties = properties;
 
-                       SqlMapper sqlMap = builder.Configure( stream );
+                       SqlMapper mapper = builder.Configure( stream );
 
-                       Assert.IsNotNull(sqlMap);
+                       Assert.IsNotNull(mapper);
                }
                #endregion 
 

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs?rev=409004&r1=409003&r2=409004&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs
 Tue May 23 13:42:23 2006
@@ -1154,7 +1154,20 @@
                        Assert.IsTrue(rowNumber == 4);
                }
 
+        /// <summary>
+        /// Test Execute delete Via Inline Parameters
+        /// </summary>
+        [Test]
+        public void TestDeleteViaInlineParameters()
+        {
+            Account account = NewAccount6();
 
+            sqlMap.Insert("InsertAccountViaParameterMap", account);
+
+            int rowNumber = sqlMap.Delete("DeleteAccountViaInlineParameters", 
6);
+
+            Assert.IsTrue(rowNumber == 1);
+        }
 
                #endregion
 

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements/Statement.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements/Statement.cs?rev=409004&r1=409003&r2=409004&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements/Statement.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements/Statement.cs
 Tue May 23 13:42:23 2006
@@ -97,6 +97,7 @@
                private string _extendStatement = string.Empty;
         [NonSerialized]
         private IFactory _resultClassFactory = null;
+           [NonSerialized]
         private IFactory _listClassFactory = null;
 
                #endregion
@@ -299,7 +300,10 @@
                /// <summary>
                /// Do not use direclty, only for serialization.
                /// </summary>
-               public Statement() {}
+               public Statement()
+               {
+                   
+               }
                #endregion
 
                #region Methods
@@ -343,7 +347,7 @@
                /// </summary>
                /// <returns>An object.</returns>
                public object CreateInstanceOfResultClass()
-               {
+               {                   
                        if (_resultClass.IsPrimitive || _resultClass == typeof 
(string))
                        {
                                TypeCode typeCode = 
Type.GetTypeCode(_resultClass);
@@ -351,22 +355,36 @@
                        }
                        else
                        {
-                               if (_resultClass == typeof (DateTime))
-                               {
-                                       return new DateTime();
-                               }
-                               else if (_resultClass == typeof (Decimal))      
                        
-                               {
-                                       return new Decimal();
-                               }
-                               else if (_resultClass == typeof (Guid))         
                
-                               {
-                                       return Guid.Empty;
-                               }
-                               else if (_resultClass == typeof (TimeSpan))
-                               {
-                                       return new TimeSpan(0);
-                               }
+                if (_resultClass.IsValueType)
+                {
+                                   if (_resultClass == typeof (DateTime))
+                                   {
+                                           return new DateTime();
+                                   }
+                                   else if (_resultClass == typeof (Decimal))  
                        
+                                   {
+                                           return new Decimal();
+                                   }
+                                   else if (_resultClass == typeof (Guid))     
                        
+                                   {
+                                           return Guid.Empty;
+                                   }
+                                   else if (_resultClass == typeof (TimeSpan))
+                                   {
+                                           return new TimeSpan(0);
+                    }
+#if dotnet2
+                    else if (_resultClass.IsGenericType && 
typeof(Nullable<>).IsAssignableFrom(_resultClass.GetGenericTypeDefinition()))
+                    {
+                        return TypeUtils.InstantiateNullableType(_resultClass);
+                    }
+#endif                   
+                                   else
+                    {
+                        throw new NotImplementedException("Unable to 
instanciate value type");
+                    }                    
+
+                }
                                else
                                {
                                        return 
_resultClassFactory.CreateInstance(null);

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/DataExchange/ComplexDataExchange.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/DataExchange/ComplexDataExchange.cs?rev=409004&r1=409003&r2=409004&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/DataExchange/ComplexDataExchange.cs 
(original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/DataExchange/ComplexDataExchange.cs 
Tue May 23 13:42:23 2006
@@ -52,14 +52,22 @@
                /// <param name="parameterObject"></param>
                public override object GetData(ParameterProperty mapping, 
object parameterObject)
                {
-                       if 
(this.DataExchangeFactory.TypeHandlerFactory.IsSimpleType(parameterObject.GetType()))
-                       {
-                               return parameterObject;
-                       }
-                       else
-                       {
-                               return 
ObjectProbe.GetMemberValue(parameterObject, mapping.PropertyName, 
this.DataExchangeFactory.AccessorFactory);
-                       }
+            if (parameterObject!=null)
+            {
+                           if 
(this.DataExchangeFactory.TypeHandlerFactory.IsSimpleType(parameterObject.GetType()))
+                           {
+                                   return parameterObject;
+                           }
+                           else
+                           {
+                                   return 
ObjectProbe.GetMemberValue(parameterObject, mapping.PropertyName, 
this.DataExchangeFactory.AccessorFactory);
+                           }               
+            }
+                   else
+            {
+                return null;
+            }
+
                }
 
                /// <summary>

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/ResultClassStrategy.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/ResultClassStrategy.cs?rev=409004&r1=409003&r2=409004&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/ResultClassStrategy.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/ResultClassStrategy.cs
 Tue May 23 13:42:23 2006
@@ -61,23 +61,16 @@
                /// <param name="resultObject">The result object.</param>
                public object Process(RequestScope request, IDataReader reader, 
object resultObject)
                {
-                       object outObject = resultObject; 
-
-                       if (outObject == null) 
-                       {
-                               outObject = 
request.Statement.CreateInstanceOfResultClass();
-                       }
-
                        // Check if the ResultClass is a 'primitive' Type
                        if 
(request.DataExchangeFactory.TypeHandlerFactory.IsSimpleType(request.Statement.ResultClass))
                        {
                                return _simpleTypeStrategy.Process(request, 
reader, resultObject);
                        }
-                       else if (outObject is IDictionary) 
+            else if 
(typeof(IDictionary).IsAssignableFrom(request.Statement.ResultClass)) 
                        {
                                return _dictionaryStrategy.Process(request, 
reader, resultObject);
                        }
-                       else if (outObject is IList) 
+            else if 
(typeof(IList).IsAssignableFrom(request.Statement.ResultClass)) 
                        {
                                return _listStrategy.Process(request, reader, 
resultObject);
                        }


Reply via email to