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/02/06 22:08:08 UTC

svn commit: r375372 - in /ibatis/trunk/cs/mapper: IBatisNet.DataMapper.Test/NUnit/SqlMapTests/CacheKeyTest.cs IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ResultMapTest.cs IBatisNet.DataMapper/MappedStatements/MappedStatement.cs

Author: gbayon
Date: Mon Feb  6 13:08:06 2006
New Revision: 375372

URL: http://svn.apache.org/viewcvs?rev=375372&view=rev
Log:
- Fixed for Array type and .NET v2

Modified:
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/CacheKeyTest.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ResultMapTest.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/CacheKeyTest.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/CacheKeyTest.cs?rev=375372&r1=375371&r2=375372&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/CacheKeyTest.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/CacheKeyTest.cs Mon Feb  6 13:08:06 2006
@@ -47,9 +47,13 @@
 
 			key1.Update("HS1CS001");
 			key2.Update("HS1D4001");
+        /*
+         The string hash algorithm is not an industry standard and is not guaranteed to produce the same behaviour between versions. 
+         And in fact it does not. The .NET 2.0 CLR uses a different algorithm for string hashing than the .NET 1.1 CLR. 
+        */
 
 #if dotnet2
-            Assert.Ignore("Will not work in .NET 2.0");
+            Assert.Ignore("The .NET 2.0 CLR uses a different algorithm for string hashing than the .NET 1.1 CLR.");
 #else
 			Assert.AreEqual( key1.GetHashCode(), key2.GetHashCode(), "Expect same hashcode.");
 			Assert.IsFalse( key1.Equals(key2),"Expect not equal");
@@ -57,6 +61,8 @@
         }
 
 		[Test]
+       
+
 		public void CacheKeyWithTwoParamsSameHashcode() 
 		{
 			CacheKey key1 = new CacheKey();
@@ -68,12 +74,12 @@
 			key2.Update("HS1D4001");
 			key2.Update("HS1CS001");
 
-            #if dotnet2
-            Assert.Ignore("Will not work in .NET 2.0");
-            #else
+#if dotnet2
+            Assert.Ignore("The .NET 2.0 CLR uses a different algorithm for string hashing than the .NET 1.1 CLR.");
+#else
 			Assert.AreEqual(key1.GetHashCode(), key2.GetHashCode(), "Expect same hashcode.");
 			Assert.IsFalse(key1.Equals(key2), "Expect not equal");
-            #endif
+#endif
         }
 
 	}

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ResultMapTest.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ResultMapTest.cs?rev=375372&r1=375371&r2=375372&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ResultMapTest.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ResultMapTest.cs Mon Feb  6 13:08:06 2006
@@ -232,15 +232,11 @@
 		[Test]
 		public void TestArrayMapping() 
 		{
-            #if dotnet2
-            Assert.Ignore("Will not work in .NET 2.0");
-            #else
 			Order order = (Order)sqlMap.QueryForObject("GetOrderWithLineItemArray", 1);
 
 			AssertOrder1(order);
 			Assert.IsNotNull( order.LineItemsArray );
 			Assert.AreEqual(2, order.LineItemsArray.Length);
-            #endif
         }
 
 		/// <summary>

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs?rev=375372&r1=375371&r2=375372&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs Mon Feb  6 13:08:06 2006
@@ -1256,9 +1256,13 @@
 					postSelect.ResultProperty = mapping;
 
 					#region Collection object or .NET object
+					if (mapping.PropertyInfo.PropertyType.BaseType == typeof(Array))
+					{
+						postSelect.Method = ExecuteMethod.ExecuteQueryForArrayList;
+					}
 					// Check if the object to Map implement 'IList' or is IList type
 					// If yes the ResultProperty is map to a IList object
-					if ( (mapping.PropertyInfo.PropertyType.GetInterface("IList") != null) || 
+					else if ( (mapping.PropertyInfo.PropertyType.GetInterface("IList") != null) || 
 						(mapping.PropertyInfo.PropertyType == typeof(IList)))
 					{
 						object values = null;
@@ -1280,10 +1284,6 @@
 							}
 						}
 					} 
-					else if (mapping.PropertyInfo.PropertyType.IsArray)
-					{
-						postSelect.Method = ExecuteMethod.ExecuteQueryForArrayList;
-					}
 					else // The ResultProperty is map to a .Net object
 					{
 						postSelect.Method = ExecuteMethod.ExecuteQueryForObject;