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/02 21:46:15 UTC

svn commit: r470514 [1/2] - in /ibatis/trunk/cs/mapper: ./ IBatisNet.Common/Utilities/ IBatisNet.DataMapper.Test/ IBatisNet.DataMapper.Test/Domain/ IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/ IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ IBatisNet.D...

Author: gbayon
Date: Thu Nov  2 12:46:13 2006
New Revision: 470514

URL: http://svn.apache.org/viewvc?view=rev&rev=470514
Log:
In progress for IBATISNET-193
Added class diagram fot ResultStrategy

Added:
    ibatis/trunk/cs/mapper/DataMapper.2003.sln
      - copied unchanged from r469230, ibatis/trunk/cs/mapper/DataMapper.sln
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Item.cs   (with props)
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Product.cs   (with props)
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/GroupByMapping.xml
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/GroupByTest.cs   (with props)
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/Items-init.sql
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/Products-init.sql
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/ClassDiagram.cd
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/GroupByStrategy.cs   (with props)
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/MapStrategy.cs   (with props)
Modified:
    ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/HashCodeProvider.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Category.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Order.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.2005.csproj
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConstructorTest.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Generics/ResultMapTest.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Generics/StatementTest.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/MSSQL/Generics/StatementTest.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ResultMapTest.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/category-init.sql
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/line-item-init.sql
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/order-init.sql
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_SqlClient.config
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/AutoResultMap.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/IResultMap.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultMap.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/ResultMapDeSerializer.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.csproj
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/BaseStrategy.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/DefaultStrategy.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/IPropertyStrategy.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/ResultMapStrategy.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectArrayStrategy.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectGenericListStrategy.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectListStrategy.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectObjectStrategy.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectStrategy.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/ResultStrategyFactory.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Proxy/LazyListGeneric.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/RequestScope.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMap.xsd

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/HashCodeProvider.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/HashCodeProvider.cs?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/HashCodeProvider.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/HashCodeProvider.cs Thu Nov  2 12:46:13 2006
@@ -26,6 +26,8 @@
 
 #region Imports
 using System;
+using System.Runtime.CompilerServices;
+
 #endregion
 
 namespace IBatisNet.Common.Utilities
@@ -58,8 +60,12 @@
 		/// </remarks>
 		public static int GetIdentityHashCode(object obj)
 		{
+            //#if dotnet2
+            //return RuntimeHelpers.GetHashCode(obj);
+            //#else
 			// call the underlying System.Object.GetHashCode()
 			return (int)getHashCodeMethodInfo.Invoke(obj, null);
+            //#endif
 		}
 	}
 }

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Category.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Category.cs?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Category.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Category.cs Thu Nov  2 12:46:13 2006
@@ -1,4 +1,5 @@
 using System;
+using System.Collections;
 
 namespace IBatisNet.DataMapper.Test.Domain
 {
@@ -10,36 +11,34 @@
 		private int _id;
 		private string _name;
 		private Guid _guid;
+	    private IList _products = new ArrayList();
 
+	    public IList Products
+		{
+			get { return _products; }
+			set { _products = value; }
+		}
+	    
 		public Guid EmptyGuid
 		{
-			get
-			{
-				return Guid.Empty; 
-			}
+			get { return Guid.Empty; }
 		}
 
 		public Guid Guid
 		{
-			get
-			{
-				return _guid; 
-			}
-			set
-			{ 
-				_guid = value; 
-			}
+			get { return _guid; }
+			set { _guid = value; }
 		}
 
 		public string GuidString {
-			get {
-				return _guid.ToString(); 
-			}
-			set { 
+			get { return _guid.ToString();  }
+			set 
+			{ 
 				if (value == null) {
 					_guid = Guid.Empty;
 				}
-				else {
+				else 
+				{
 					_guid = new Guid(value.ToString());
 				}
 			}
@@ -47,26 +46,14 @@
 
 		public int Id
 		{
-			get
-			{
-				return _id; 
-			}
-			set
-			{ 
-				_id = value; 
-			}
+			get { return _id; }
+			set { _id = value; }
 		}
 
 		public string Name
 		{
-			get
-			{
-				return _name; 
-			}
-			set
-			{ 
-				_name = value; 
-			}
+			get { return _name; }
+			set { _name = value; }
 		}
 
 	}

Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Item.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Item.cs?view=auto&rev=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Item.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Item.cs Thu Nov  2 12:46:13 2006
@@ -0,0 +1,34 @@
+namespace IBatisNet.DataMapper.Test.Domain
+{
+    public class Item
+    {
+        private int _id;
+        private string _status;
+        private decimal _unitCost;
+        private int _quantity;
+
+        public int Id
+        {
+            get { return _id; }
+            set { _id = value; }
+        }
+
+        public string Status
+        {
+            get { return _status; }
+            set { _status = value; }
+        }
+
+        public decimal UnitCost
+        {
+            get { return _unitCost; }
+            set { _unitCost = value; }
+        }
+
+        public int Quantity
+        {
+            get { return _quantity; }
+            set { _quantity = value; }
+        }
+    }
+}

Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Item.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Item.cs
------------------------------------------------------------------------------
    svn:keywords = Id LastChangedDate LastChangedBy

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Order.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Order.cs?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Order.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Order.cs Thu Nov  2 12:46:13 2006
@@ -22,7 +22,7 @@
 		private string _city;
 		private string _province;
 		private string _postalCode;
-		private IList _lineItemsIList;
+		private IList _lineItemsIList ;//= new ArrayList();
         private LineItemCollection _collection;
 		private LineItem[] _lineItemsArray;
 		private LineItem _favouriteLineItem;

Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Product.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Product.cs?view=auto&rev=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Product.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Product.cs Thu Nov  2 12:46:13 2006
@@ -0,0 +1,32 @@
+using System.Collections;
+
+namespace IBatisNet.DataMapper.Test.Domain
+{
+    /// <summary>
+    /// 
+    /// </summary>
+    public class Product
+    {
+        private int _id;
+        private string _name;
+        private IList _items = new ArrayList();
+
+        public int Id
+        {
+            get { return _id; }
+            set { _id = value; }
+        }
+
+        public string Name
+        {
+            get { return _name; }
+            set { _name = value; }
+        }
+        
+        public IList Items
+        {
+            get { return _items; }
+            set { _items = value; }
+        }
+    }
+}

Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Product.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Product.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=470514&r1=470513&r2=470514
==============================================================================
--- 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 Thu Nov  2 12:46:13 2006
@@ -153,6 +153,7 @@
     </Compile>
     <Compile Include="Domain\ImmutableCategory.cs" />
     <Compile Include="Domain\ImmutableCategoryPropertyContainer.cs" />
+    <Compile Include="Domain\Item.cs" />
     <Compile Include="Domain\LineItem.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -176,6 +177,7 @@
     <Compile Include="Domain\OuiNonBoolTypeHandlerCallback.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Domain\Product.cs" />
     <Compile Include="Domain\Query.cs" />
     <Compile Include="Domain\Sample.cs">
       <SubType>Code</SubType>
@@ -223,6 +225,7 @@
     <Compile Include="NUnit\SqlMapTests\Generics\ResultMapTest.cs" />
     <Compile Include="NUnit\SqlMapTests\Generics\ResultClassTest.cs" />
     <Compile Include="NUnit\SqlMapTests\Generics\StatementTest.cs" />
+    <Compile Include="NUnit\SqlMapTests\GroupByTest.cs" />
     <Compile Include="NUnit\SqlMapTests\InheritanceTest.cs">
       <SubType>Code</SubType>
     </Compile>
@@ -326,6 +329,7 @@
     <Content Include="Maps\MSSQL\SqlClient\DynamicAccount.xml" />
     <Content Include="Maps\MSSQL\SqlClient\EmbedParameter.xml" />
     <Content Include="Maps\MSSQL\SqlClient\Enumeration.xml" />
+    <Content Include="Maps\MSSQL\SqlClient\GroupByMapping.xml" />
     <Content Include="Maps\MSSQL\SqlClient\LineItem.xml" />
     <Content Include="Maps\MSSQL\SqlClient\Nullable.xml" />
     <Content Include="Maps\MSSQL\SqlClient\Order.xml" />
@@ -421,11 +425,13 @@
     <Content Include="Scripts\MSSQL\embed-param-setup-init.sql" />
     <Content Include="Scripts\MSSQL\embed-param-test-init.sql" />
     <Content Include="Scripts\MSSQL\enumeration-init.sql" />
+    <Content Include="Scripts\MSSQL\Items-init.sql" />
     <Content Include="Scripts\MSSQL\line-item-init.sql" />
     <Content Include="Scripts\MSSQL\more-account-records.sql" />
     <Content Include="Scripts\MSSQL\Nullable-init.sql" />
     <Content Include="Scripts\MSSQL\order-init.sql" />
     <Content Include="Scripts\MSSQL\other-init.sql" />
+    <Content Include="Scripts\MSSQL\Products-init.sql" />
     <Content Include="Scripts\MSSQL\ps_SelectAccount.sql" />
     <Content Include="Scripts\MSSQL\ps_SelectAllAccount.sql" />
     <Content Include="Scripts\MSSQL\ps_SelectLineItem.sql" />

Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/GroupByMapping.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/GroupByMapping.xml?view=auto&rev=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/GroupByMapping.xml (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/GroupByMapping.xml Thu Nov  2 12:46:13 2006
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<sqlMap namespace="GroupByMapping"
+  xmlns="http://ibatis.apache.org/mapping"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+  <alias>
+    <typeAlias alias="Product" type="IBatisNet.DataMapper.Test.Domain.Product, IBatisNet.DataMapper.Test"/>
+    <typeAlias alias="Item" type="IBatisNet.DataMapper.Test.Domain.Item, IBatisNet.DataMapper.Test"/>
+  </alias>
+  
+  <resultMaps>
+
+    <resultMap id="Category-Result" class="Category" groupBy="Id">
+      <result property="Id" column="Category_Id"/>
+      <result property="Name" column="Category_Name"/>
+      <result property="Products" resultMapping="GroupByMapping.Product-Result"/>
+    </resultMap>
+       
+    <resultMap id="Product-Result" class="Product" groupBy="Id">
+      <result property="Id" column="Product_Id"/>
+      <result property="Name" column="Product_Name"/>
+      <result property="Items" resultMapping="GroupByMapping.Item-Result"/>
+    </resultMap>
+
+    <resultMap id="Item-Result" class="Item">
+      <result property="Id" column="Item_Id"/>
+      <result property="UnitCost" column="Item_UnitCost"/>
+      <result property="Status" column="Item_Status"/>
+      <result property="Quantity" column="Item_Quantity"/>
+    </resultMap>
+
+    <resultMap id="Order-GroupBy-Result" class="Order" groupBy="Id">
+      <result property="Id"         column="Order_ID"/>
+      <result property="City"       column="Order_City"/>
+      <result property="LineItemsIList" resultMapping="GroupByMapping.LineItem-GroupBy" />
+      <result property="Account" resultMapping="Account.account-result-nullable-email" />
+    </resultMap>
+
+    <resultMap id="LineItem-GroupBy" class="LineItem">
+      <result property="Id"			column="LineItem_ID"/>
+      <result property="Code"			column="LineItem_Code"/>
+      <result property="Quantity"		column="LineItem_Quantity"/>
+      <result property="Price"		column="LineItem_Price" />
+    </resultMap>
+    
+  </resultMaps>
+
+  <statements>
+
+    <select id="GetAllCategories" resultMap="Category-Result" >
+      select
+      Category_Id, Category_Name,
+      p.Id as Product_Id, p.Name as Product_Name,
+      i.Id as Item_Id, i.UnitCost as Item_UnitCost, i.Status as Item_Status, i.Quantity as Item_Quantity
+      from Categories c, Products p, Items i
+      where c.Id = p.Category_Id
+      and p.Id = i.Product_Id
+    </select>
+
+    <statement id="GetOrderLineItem"
+                resultMap="Order-GroupBy-Result" >
+      select
+      Orders.Order_ID,
+      Order_City,
+      LineItem_ID,
+      LineItem_Code,
+      LineItem_Quantity,
+      LineItem_Price,
+      Accounts.Account_Id,
+      Accounts.Account_FirstName,
+      Accounts.Account_LastName,
+      Accounts.Account_Email
+      FROM         Orders INNER JOIN
+      LineItems ON Orders.Order_ID = LineItems.Order_ID LEFT OUTER JOIN
+      Accounts ON Orders.Account_ID = Accounts.Account_ID
+      Order by Orders.Order_ID
+    </statement>
+    
+  </statements>
+  
+</sqlMap>

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConstructorTest.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConstructorTest.cs?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConstructorTest.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ConstructorTest.cs Thu Nov  2 12:46:13 2006
@@ -197,7 +197,7 @@
 			AssertAccount1(order.Account);
 			
 			Assert.IsNotNull(order.LineItemsIList);
-			Assert.AreEqual(2, order.LineItemsIList.Count);
+			Assert.AreEqual(3, order.LineItemsIList.Count);
 		}
 
 		/// <summary>
@@ -211,7 +211,7 @@
 			AssertAccount1(order.Account);
 			
 			Assert.IsNotNull( order.LineItemsArray );
-			Assert.AreEqual(2, order.LineItemsArray.Length);
+			Assert.AreEqual(3, order.LineItemsArray.Length);
 		}
 
 		/// <summary>
@@ -225,7 +225,7 @@
 			AssertAccount1(order.Account);
 			
 			Assert.IsNotNull( order.LineItemsCollection );
-            Assert.AreEqual(2, order.LineItemsCollection.Count);
+            Assert.AreEqual(3, order.LineItemsCollection.Count);
 		}
 
 #if dotnet2
@@ -239,7 +239,7 @@
             AssertOrder1(order);
 
             Assert.IsNotNull(order.LineItemsGenericList);
-            Assert.AreEqual(2, order.LineItemsGenericList.Count);
+            Assert.AreEqual(3, order.LineItemsGenericList.Count);
         }
 
         /// <summary>
@@ -252,7 +252,7 @@
             AssertOrder1(order);
 
             Assert.IsNotNull(order.LineItemsCollection2);
-            Assert.AreEqual(2, order.LineItemsCollection2.Count);
+            Assert.AreEqual(3, order.LineItemsCollection2.Count);
         }
 #endif
 		#endregion

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Generics/ResultMapTest.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Generics/ResultMapTest.cs?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Generics/ResultMapTest.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Generics/ResultMapTest.cs Thu Nov  2 12:46:13 2006
@@ -63,7 +63,7 @@
 
             // Check generic IList collection
             Assert.IsNotNull(order.LineItemsGenericList);
-            Assert.AreEqual(2, order.LineItemsGenericList.Count);
+            Assert.AreEqual(3, order.LineItemsGenericList.Count);
         }
 
         /// <summary>
@@ -79,7 +79,7 @@
 
             // Check generic IList collection
             Assert.IsNotNull(order.LineItemsGenericList);
-            Assert.AreEqual(2, order.LineItemsGenericList.Count);
+            Assert.AreEqual(3, order.LineItemsGenericList.Count);
         }
 
         /// <summary>
@@ -95,7 +95,7 @@
 
             // Check generic collection
             Assert.IsNotNull(order.LineItemsGenericList);
-            Assert.AreEqual(2, order.LineItemsGenericList.Count);
+            Assert.AreEqual(3, order.LineItemsGenericList.Count);
             LineItemCollection2 lines = (LineItemCollection2)order.LineItemsGenericList;
         }
 
@@ -111,7 +111,7 @@
             AssertOrder1(order);
 
             Assert.IsNotNull(order.LineItemsGenericList);
-            Assert.AreEqual(2, order.LineItemsGenericList.Count);
+            Assert.AreEqual(3, order.LineItemsGenericList.Count);
             LineItemCollection2 lines = (LineItemCollection2)order.LineItemsGenericList;
         }
 
@@ -127,7 +127,7 @@
             AssertOrder1(order);
 
             Assert.IsNotNull(order.LineItemsCollection2);
-            Assert.AreEqual(2, order.LineItemsCollection2.Count);
+            Assert.AreEqual(3, order.LineItemsCollection2.Count);
 
             IEnumerator<LineItem> e = ((IEnumerable<LineItem>)order.LineItemsCollection2).GetEnumerator();
             while (e.MoveNext())
@@ -149,7 +149,7 @@
             AssertOrder1(order);
 
             Assert.IsNotNull(order.LineItemsCollection2);
-            Assert.AreEqual(2, order.LineItemsCollection2.Count);
+            Assert.AreEqual(3, order.LineItemsCollection2.Count);
 
             IEnumerator<LineItem> e = ((IEnumerable<LineItem>)order.LineItemsCollection2).GetEnumerator();
             while (e.MoveNext())

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Generics/StatementTest.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Generics/StatementTest.cs?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Generics/StatementTest.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Generics/StatementTest.cs Thu Nov  2 12:46:13 2006
@@ -190,7 +190,7 @@
         public void TestExecuteQueryForObjectViaHashtable()
         {
             Hashtable param = new Hashtable();
-            param.Add("LineItem_ID", 2);
+            param.Add("LineItem_ID", 4);
             param.Add("Order_ID", 9);
 
             LineItem testItem = sqlMap.QueryForObject<LineItem>("GetSpecificLineItem", param);

Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/GroupByTest.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/GroupByTest.cs?view=auto&rev=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/GroupByTest.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/GroupByTest.cs Thu Nov  2 12:46:13 2006
@@ -0,0 +1,67 @@
+
+using System.Collections;
+using IBatisNet.DataMapper.Test.Domain;
+using NUnit.Framework;
+
+namespace IBatisNet.DataMapper.Test.NUnit.SqlMapTests
+{
+    /// <summary>
+    /// Summary description for GroupByTest.
+    /// </summary>
+    [TestFixture]
+    public class GroupByTest : BaseTest
+    {
+        #region SetUp & TearDown
+
+        /// <summary>
+        /// SetUp
+        /// </summary>
+        [SetUp]
+        public void Init()
+        {
+            InitScript(sqlMap.DataSource, ScriptDirectory + "order-init.sql");
+            InitScript(sqlMap.DataSource, ScriptDirectory + "line-item-init.sql");
+
+            Order order = new Order();
+            order.Id = 11;
+            LineItem item = new LineItem();
+            item.Id = 10;
+            item.Code = "blah";
+            item.Price = 44.00m;
+            item.Quantity = 1;
+            item.Order = order;
+
+            sqlMap.Insert("InsertLineItemPostKey", item);
+        }
+
+        /// <summary>
+        /// TearDown
+        /// </summary>
+        [TearDown]
+        public void Dispose()
+        {
+        }
+
+        #endregion
+
+        /// <summary>
+        /// Test Select N+1 on Order/LineItem
+        /// </summary>
+        [Test]
+        public void TestOrderLineItemGroupBy()
+        {
+            IList list = sqlMap.QueryForList("GetOrderLineItem", null);
+
+            Assert.AreEqual(11, list.Count);
+            
+            Order order = (Order)list[0];
+            Assert.AreEqual(3, order.LineItemsIList.Count);
+            Assert.IsNotNull(order.Account);
+            AssertAccount1(order.Account);
+
+            order = (Order)list[10];
+            Assert.AreEqual(1, order.LineItemsIList.Count);
+            Assert.IsNull(order.Account);
+        }
+    }
+}

Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/GroupByTest.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/GroupByTest.cs
------------------------------------------------------------------------------
    svn:keywords = Id LastChangedDate LastChangedBy

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/MSSQL/Generics/StatementTest.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/MSSQL/Generics/StatementTest.cs?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/MSSQL/Generics/StatementTest.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/MSSQL/Generics/StatementTest.cs Thu Nov  2 12:46:13 2006
@@ -183,7 +183,7 @@
 
             // Check generic collection
             Assert.IsNotNull(order.LineItemsCollection);
-            Assert.AreEqual(2, order.LineItemsCollection.Count);
+            Assert.AreEqual(3, order.LineItemsCollection.Count);
         }
 		#endregion
 

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ResultMapTest.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ResultMapTest.cs?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ResultMapTest.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/ResultMapTest.cs Thu Nov  2 12:46:13 2006
@@ -71,7 +71,7 @@
 
             AssertOrder1(order);
             Assert.IsNotNull(order.LineItemsIList);
-            Assert.AreEqual(2, order.LineItemsIList.Count);
+            Assert.AreEqual(3, order.LineItemsIList.Count);
         }
 
         /// <summary>
@@ -87,7 +87,7 @@
             Assert.IsNotNull(order.LineItemsIList);
             Assert.IsTrue(typeof(IList).IsAssignableFrom(order.LineItemsIList.GetType()));
 
-            Assert.AreEqual(2, order.LineItemsIList.Count);
+            Assert.AreEqual(3, order.LineItemsIList.Count);
             // After a call to a method from a proxy object,
             // the proxy object is replaced by his real object.
             Assert.IsTrue(order.LineItemsIList is ArrayList);
@@ -108,7 +108,7 @@
             Assert.IsNotNull(order.LineItemsIList);
             Assert.IsTrue(typeof(IList).IsAssignableFrom(order.LineItemsIList.GetType()));
 
-            Assert.AreEqual(2, order.LineItemsIList.Count);
+            Assert.AreEqual(3, order.LineItemsIList.Count);
             // After a call to a method from a proxy object,
             // the proxy object is replaced by his real object.
             Assert.IsTrue(order.LineItemsIList is ArrayList);
@@ -128,7 +128,7 @@
             AssertOrder1(order);
 
             Assert.IsNotNull(order.LineItemsCollection);
-            Assert.AreEqual(2, order.LineItemsCollection.Count);
+            Assert.AreEqual(3, order.LineItemsCollection.Count);
 
             IEnumerator e = ((IEnumerable)order.LineItemsCollection).GetEnumerator();
             while (e.MoveNext())
@@ -207,7 +207,7 @@
 
             // Check strongly typed collection
             Assert.IsNotNull(order.LineItemsCollection);
-            Assert.AreEqual(2, order.LineItemsCollection.Count);
+            Assert.AreEqual(3, order.LineItemsCollection.Count);
         }
 
         /// <summary>
@@ -223,7 +223,7 @@
 
             // Check IList collection
             Assert.IsNotNull(order.LineItemsIList);
-            Assert.AreEqual(2, order.LineItemsIList.Count);
+            Assert.AreEqual(3, order.LineItemsIList.Count);
         }
 
         /// <summary>
@@ -236,7 +236,7 @@
 
             AssertOrder1(order);
             Assert.IsNotNull(order.LineItemsArray);
-            Assert.AreEqual(2, order.LineItemsArray.Length);
+            Assert.AreEqual(3, order.LineItemsArray.Length);
         }
 
         /// <summary>
@@ -251,7 +251,7 @@
             AssertOrder1(order);
 
             Assert.IsNotNull(order.LineItemsCollection);
-            Assert.AreEqual(2, order.LineItemsCollection.Count);
+            Assert.AreEqual(3, order.LineItemsCollection.Count);
 
             IEnumerator e = ((IEnumerable)order.LineItemsCollection).GetEnumerator();
             while (e.MoveNext())
@@ -284,8 +284,8 @@
             AssertOrder1(order);
 
             Assert.IsNotNull(order.FavouriteLineItem);
-            Assert.AreEqual(2, order.FavouriteLineItem.Id, "order.FavouriteLineItem.Id");
-            Assert.AreEqual("ESM-23", order.FavouriteLineItem.Code);
+            Assert.AreEqual(1, order.FavouriteLineItem.Id, "order.FavouriteLineItem.Id");
+            Assert.AreEqual("ESM-34", order.FavouriteLineItem.Code);
 
         }
 
@@ -301,8 +301,8 @@
             AssertOrder1(order);
 
             Assert.IsNotNull(order.FavouriteLineItem);
-            Assert.AreEqual(2, order.FavouriteLineItem.Id, "order.FavouriteLineItem.Id");
-            Assert.AreEqual("ESM-23", order.FavouriteLineItem.Code);
+            Assert.AreEqual(1, order.FavouriteLineItem.Id, "order.FavouriteLineItem.Id");
+            Assert.AreEqual("ESM-34", order.FavouriteLineItem.Code);
         }
 
         /// <summary>
@@ -316,8 +316,8 @@
             AssertOrder1(order);
 
             Assert.IsNotNull(order.FavouriteLineItem);
-            Assert.AreEqual(2, order.FavouriteLineItem.Id, "order.FavouriteLineItem.Id");
-            Assert.AreEqual("ESM-23", order.FavouriteLineItem.Code);
+            Assert.AreEqual(1, order.FavouriteLineItem.Id, "order.FavouriteLineItem.Id");
+            Assert.AreEqual("ESM-34", order.FavouriteLineItem.Code);
 
         }
 
@@ -333,11 +333,11 @@
 
             Assert.IsNotNull(order1);
             Assert.IsNotNull(order1.FavouriteLineItem);
-            Assert.AreEqual(2, order1.FavouriteLineItem.Id);
+            Assert.AreEqual(1, order1.FavouriteLineItem.Id);
 
             Assert.IsNotNull(order2);
             Assert.IsNotNull(order2.FavouriteLineItem);
-            Assert.AreEqual(1, order2.FavouriteLineItem.Id);
+            Assert.AreEqual(17, order2.FavouriteLineItem.Id);
 
         }
 
@@ -352,7 +352,7 @@
 
             Assert.IsNotNull(order1);
             Assert.IsNotNull(order1.FavouriteLineItem);
-            Assert.AreEqual(2, order1.FavouriteLineItem.Id);
+            Assert.AreEqual(1, order1.FavouriteLineItem.Id);
         }
 
         /// <summary>
@@ -375,7 +375,7 @@
         {
             Hashtable param = new Hashtable();
             param.Add("LineItem_ID", 1);
-            param.Add("Order_ID", 10);
+            param.Add("Order_ID", 1);
             decimal price = (decimal)sqlMap.QueryForObject("GetLineItemPrice", param);
             Assert.AreEqual(45.43m, price);
         }

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?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs Thu Nov  2 12:46:13 2006
@@ -166,7 +166,7 @@
         public void TestExecuteQueryForObjectViaHashtable()
         {
             Hashtable param = new Hashtable();
-            param.Add("LineItem_ID", 2);
+            param.Add("LineItem_ID", 4);
             param.Add("Order_ID", 9);
 
             LineItem testItem = sqlMap.QueryForObject("GetSpecificLineItem", param) as LineItem;
@@ -531,12 +531,12 @@
         [Test]
         public void TestQueryForListWithListClass()
         {
-            LineItemCollection linesItem = sqlMap.QueryForList("GetLineItemsForOrderWithListClass", 10) as LineItemCollection;
+            LineItemCollection linesItem = sqlMap.QueryForList("GetLineItemsForOrderWithListClass", 6) as LineItemCollection;
 
             Assert.IsNotNull(linesItem);
             Assert.AreEqual(2, linesItem.Count);
-            Assert.AreEqual("ESM-34", linesItem[0].Code);
-            Assert.AreEqual("QSM-98", linesItem[1].Code);
+            Assert.AreEqual("ASM-45", linesItem[0].Code);
+            Assert.AreEqual("QSM-39", linesItem[1].Code);
         }
 
         /// <summary>
@@ -828,7 +828,7 @@
         {
             LineItem item = new LineItem();
 
-            item.Id = 10;
+            item.Id = 350;
             item.Code = "blah";
             item.Order = new Order();
             item.Order.Id = 9;
@@ -842,10 +842,10 @@
 
             Hashtable param = new Hashtable();
             param.Add("Order_ID", 9);
-            param.Add("LineItem_ID", 10);
+            param.Add("LineItem_ID", 350);
             LineItem testItem = (LineItem)sqlMap.QueryForObject("GetSpecificLineItem", param);
             Assert.IsNotNull(testItem);
-            Assert.AreEqual(10, testItem.Id);
+            Assert.AreEqual(350, testItem.Id);
         }
 
         /// <summary>
@@ -1151,7 +1151,7 @@
         {
             int rowNumber = sqlMap.Delete("DeleteWithComments", null);
 
-            Assert.IsTrue(rowNumber == 4);
+            Assert.IsTrue(rowNumber == 3);
         }
 
         /// <summary>

Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/Items-init.sql
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/Items-init.sql?view=auto&rev=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/Items-init.sql (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/Items-init.sql Thu Nov  2 12:46:13 2006
@@ -0,0 +1,20 @@
+-- Creating Table
+
+use [IBatisNet]
+
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Items]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
+BEGIN
+	drop table [dbo].[Items]
+END
+
+CREATE TABLE [Items] (
+	[ID] [int] NOT NULL ,
+	[Status] [varchar] (64)  NULL ,
+	[Quantity] [int] NOT NULL ,
+	[UnitCost] [decimal](18, 2) NULL ,
+	[Product_Id] [int] NOT NULL ,
+	CONSTRAINT [PK_Items] PRIMARY KEY  CLUSTERED 
+	(
+		[ID]
+	)  ON [PRIMARY] ,
+) ON [PRIMARY]
\ No newline at end of file

Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/Products-init.sql
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/Products-init.sql?view=auto&rev=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/Products-init.sql (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/Products-init.sql Thu Nov  2 12:46:13 2006
@@ -0,0 +1,18 @@
+-- Creating Table
+
+use [IBatisNet]
+
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Products]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
+BEGIN
+	drop table [dbo].[Products]
+END
+
+CREATE TABLE [Products] (
+	[ID] [int] NOT NULL ,
+	[Name] [varchar] (64)  NULL ,
+	[Category_Id] [int] NOT NULL ,
+	 PRIMARY KEY  CLUSTERED 
+	(
+		[ID]
+	)  ON [PRIMARY] ,
+) ON [PRIMARY]
\ No newline at end of file

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/category-init.sql
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/category-init.sql?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/category-init.sql (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/category-init.sql Thu Nov  2 12:46:13 2006
@@ -8,7 +8,11 @@
 CREATE TABLE [dbo].[Categories] (
 	[Category_Id] [int] IDENTITY (1, 1) NOT NULL ,
 	[Category_Name] [varchar] (32)  NULL,
-	[Category_Guid] [uniqueidentifier] NULL  
+	[Category_Guid] [uniqueidentifier] NULL ,
+	CONSTRAINT [PK_Categories] PRIMARY KEY  CLUSTERED 
+	(
+		[Category_Id]
+	)  ON [PRIMARY] 
 ) ON [PRIMARY]
 
 -- Store procedure

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/line-item-init.sql
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/line-item-init.sql?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/line-item-init.sql (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/line-item-init.sql Thu Nov  2 12:46:13 2006
@@ -30,26 +30,26 @@
 	)
 -- Creating Test Data
 
-INSERT INTO [dbo].[LineItems] VALUES (1, 10, 'ESM-34', 1, 45.43, null);
+INSERT INTO [dbo].[LineItems] VALUES (1, 1, 'ESM-34', 1, 45.43, null);
 INSERT INTO [dbo].[LineItems] VALUES (2, 10, 'QSM-98', 8, 8.40, null);
-INSERT INTO [dbo].[LineItems] VALUES (1, 9, 'DSM-78', 2, 45.40, null);
-INSERT INTO [dbo].[LineItems] VALUES (2, 9, 'TSM-12', 2, 32.12, null);
-INSERT INTO [dbo].[LineItems] VALUES (1, 8, 'DSM-16', 4, 41.30, null);
-INSERT INTO [dbo].[LineItems] VALUES (2, 8, 'GSM-65', 1, 2.20, null);
-INSERT INTO [dbo].[LineItems] VALUES (1, 7, 'WSM-27', 7, 52.10, null);
-INSERT INTO [dbo].[LineItems] VALUES (2, 7, 'ESM-23', 2, 123.34, null);
-INSERT INTO [dbo].[LineItems] VALUES (1, 6, 'QSM-39', 9, 12.12, null);
-INSERT INTO [dbo].[LineItems] VALUES (2, 6, 'ASM-45', 6, 78.77, null);
-INSERT INTO [dbo].[LineItems] VALUES (1, 5, 'ESM-48', 3, 43.87, null);
-INSERT INTO [dbo].[LineItems] VALUES (2, 5, 'WSM-98', 7, 5.40, null);
-INSERT INTO [dbo].[LineItems] VALUES (1, 4, 'RSM-57', 2, 78.90, null);
-INSERT INTO [dbo].[LineItems] VALUES (2, 4, 'XSM-78', 9, 2.34, null);
-INSERT INTO [dbo].[LineItems] VALUES (1, 3, 'DSM-59', 3, 5.70, null);
-INSERT INTO [dbo].[LineItems] VALUES (2, 3, 'DSM-53', 3, 98.78, null);
-INSERT INTO [dbo].[LineItems] VALUES (1, 2, 'DSM-37', 4, 7.80, null);
-INSERT INTO [dbo].[LineItems] VALUES (2, 2, 'FSM-12', 2, 55.78, null);
-INSERT INTO [dbo].[LineItems] VALUES (1, 1, 'ESM-48', 8, 87.60, null);
-INSERT INTO [dbo].[LineItems] VALUES (2, 1, 'ESM-23', 1, 55.40, null);
+INSERT INTO [dbo].[LineItems] VALUES (3, 9, 'DSM-78', 2, 45.40, null);
+INSERT INTO [dbo].[LineItems] VALUES (4, 9, 'TSM-12', 2, 32.12, null);
+INSERT INTO [dbo].[LineItems] VALUES (5, 8, 'DSM-16', 4, 41.30, null);
+INSERT INTO [dbo].[LineItems] VALUES (6, 8, 'GSM-65', 1, 2.20, null);
+INSERT INTO [dbo].[LineItems] VALUES (7, 7, 'WSM-27', 7, 52.10, null);
+INSERT INTO [dbo].[LineItems] VALUES (8, 7, 'ESM-23', 2, 123.34, null);
+INSERT INTO [dbo].[LineItems] VALUES (9, 6, 'QSM-39', 9, 12.12, null);
+INSERT INTO [dbo].[LineItems] VALUES (10, 6, 'ASM-45', 6, 78.77, null);
+INSERT INTO [dbo].[LineItems] VALUES (11, 5, 'ESM-48', 3, 43.87, null);
+INSERT INTO [dbo].[LineItems] VALUES (12, 5, 'WSM-98', 7, 5.40, null);
+INSERT INTO [dbo].[LineItems] VALUES (13, 4, 'RSM-57', 2, 78.90, null);
+INSERT INTO [dbo].[LineItems] VALUES (14, 4, 'XSM-78', 9, 2.34, null);
+INSERT INTO [dbo].[LineItems] VALUES (15, 3, 'DSM-59', 3, 5.70, null);
+INSERT INTO [dbo].[LineItems] VALUES (16, 3, 'DSM-53', 3, 98.78, null);
+INSERT INTO [dbo].[LineItems] VALUES (17, 2, 'DSM-37', 4, 7.80, null);
+INSERT INTO [dbo].[LineItems] VALUES (18, 2, 'FSM-12', 2, 55.78, null);
+INSERT INTO [dbo].[LineItems] VALUES (19, 1, 'ESM-48', 8, 87.60, null);
+INSERT INTO [dbo].[LineItems] VALUES (20, 1, 'ESM-23', 1, 55.40, null);
 
 if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ps_SelectLineItem]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
 drop procedure [dbo].[ps_SelectLineItem]

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/order-init.sql
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/order-init.sql?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/order-init.sql (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/order-init.sql Thu Nov  2 12:46:13 2006
@@ -40,8 +40,8 @@
 	)
 -- Creating Test Data -- 2003-02-15 8:15:00/ 2003-02-15 8:15:00
 
-INSERT INTO [dbo].[Orders] VALUES (1, 1, '2003-02-15 8:15:00', 'VISA', '999999999999', '05/03', '11 This Street', 'Victoria', 'BC', 'C4B 4F4',2);
-INSERT INTO [dbo].[Orders] VALUES (2, 4, '2003-02-15 8:15:00', 'MC', '888888888888', '06/03', '222 That Street', 'Edmonton', 'AB', 'X4K 5Y4',1);
+INSERT INTO [dbo].[Orders] VALUES (1, 1, '2003-02-15 8:15:00', 'VISA', '999999999999', '05/03', '11 This Street', 'Victoria', 'BC', 'C4B 4F4',1);
+INSERT INTO [dbo].[Orders] VALUES (2, 4, '2003-02-15 8:15:00', 'MC', '888888888888', '06/03', '222 That Street', 'Edmonton', 'AB', 'X4K 5Y4',17);
 INSERT INTO [dbo].[Orders] VALUES (3, 3, '2003-02-15 8:15:00', 'AMEX', '777777777777', '07/03', '333 Other Street', 'Regina', 'SK', 'Z4U 6Y4',2);
 INSERT INTO [dbo].[Orders] VALUES (4, 2, '2003-02-15 8:15:00', 'MC', '666666666666', '08/03', '444 His Street', 'Toronto', 'ON', 'K4U 3S4',1);
 INSERT INTO [dbo].[Orders] VALUES (5, 5, '2003-02-15 8:15:00', 'VISA', '555555555555', '09/03', '555 Her Street', 'Calgary', 'AB', 'J4J 7S4',2);

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_SqlClient.config
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_SqlClient.config?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_SqlClient.config (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/bin/Debug/SqlMap_MSSQL_SqlClient.config Thu Nov  2 12:46:13 2006
@@ -52,5 +52,6 @@
 		<sqlMap resource="../../Maps/MSSQL/SqlClient/Nullable.xml"/>
 		<sqlMap resource="../../Maps/MSSQL/SqlClient/Simple.xml"/>
     <sqlMap resource="../../Maps/MSSQL/SqlClient/ConstructorInjection.xml"/>
+    <sqlMap resource="../../Maps/MSSQL/SqlClient/GroupByMapping.xml"/>
   </sqlMaps>
 </sqlMapConfig>

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/AutoResultMap.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/AutoResultMap.cs?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/AutoResultMap.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/AutoResultMap.cs Thu Nov  2 12:46:13 2006
@@ -27,13 +27,11 @@
 #region Using
 
 using System;
+using System.Collections.Specialized;
 using System.Data;
-using System.Reflection;
 using System.Xml.Serialization;
 using IBatisNet.Common.Utilities.Objects;
 using IBatisNet.DataMapper.DataExchange;
-using IBatisNet.DataMapper.Exceptions;
-using IBatisNet.DataMapper.Scope;
 using IBatisNet.Common.Utilities;
 
 #endregion
@@ -71,7 +69,15 @@
         
         #region IResultMap Members
 
-
+        /// <summary>
+        /// The GroupBy Properties.
+        /// </summary>
+        [XmlIgnore]
+        public StringCollection GroupByProperties
+        {
+            get { throw new NotImplementedException("The property 'GroupByProperties' is not implemented."); }
+        }
+        
         /// <summary>
         /// The collection of ResultProperty.
         /// </summary>

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/IResultMap.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/IResultMap.cs?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/IResultMap.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/IResultMap.cs Thu Nov  2 12:46:13 2006
@@ -27,6 +27,7 @@
 #region Using
 
 using System;
+using System.Collections.Specialized;
 using System.Data;
 using System.Reflection;
 using System.Xml.Serialization;
@@ -63,7 +64,12 @@
         [XmlAttribute("id")]
         string Id { get; }
 
-
+        /// <summary>
+        /// The GroupBy Properties.
+        /// </summary>
+        [XmlIgnore]
+        StringCollection GroupByProperties { get; }
+        
         /// <summary>
         /// The output type class of the resultMap.
         /// </summary>

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultMap.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultMap.cs?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultMap.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultMap.cs Thu Nov  2 12:46:13 2006
@@ -27,6 +27,7 @@
 #region Using
 
 using System;
+using System.Collections.Specialized;
 using System.Data;
 using System.Reflection;
 using System.Xml;
@@ -74,7 +75,7 @@
 		/// Token for xml path to subMap elements.
 		/// </summary>
 		private const string XML_SUBMAP = "subMap";
-        
+
 		#region Fields
         [NonSerialized]
         private bool _isInitalized = true;
@@ -86,7 +87,9 @@
 		private string _extendMap = string.Empty;
 		[NonSerialized]
 		private Type _class = null;
-		
+        [NonSerialized]
+        private StringCollection _groupByProperties = new StringCollection();
+	    
 		[NonSerialized]
 		private ResultPropertyCollection _properties = new ResultPropertyCollection();
 		[NonSerialized]
@@ -107,6 +110,15 @@
 		#region Properties
 
         /// <summary>
+        /// The GroupBy Properties.
+        /// </summary>
+        [XmlIgnore]
+        public StringCollection GroupByProperties
+        {
+            get { return _groupByProperties; }
+        }
+	    
+        /// <summary>
         /// Gets or sets a value indicating whether this instance is initalized.
         /// </summary>
         /// <value>
@@ -195,7 +207,8 @@
         /// <param name="className">The output class name of the resultMap.</param>
         /// <param name="extendMap">The extend result map bame.</param>
         /// <param name="id">Identifier used to identify the resultMap amongst the others.</param>
-        public ResultMap(ConfigurationScope configScope, string id, string className, string extendMap)
+        /// <param name="groupBy">The groupBy properties</param>
+        public ResultMap(ConfigurationScope configScope, string id, string className, string extendMap, string groupBy)
 		{
             _dataExchangeFactory = configScope.DataExchangeFactory;
             _sqlMapNameSpace = configScope.SqlMapNamespace;
@@ -210,6 +223,15 @@
             }
             _className = className;
             _extendMap = extendMap;
+             if (groupBy != null && groupBy.Length>0)
+             {
+                 string[] groupByProperties = groupBy.Split(',');
+                 for (int i = 0; i < groupByProperties.Length; i++)
+                 {
+                     _groupByProperties.Add(groupByProperties[i].Trim());
+                 }
+             }
+            
 		}
 		#endregion
 

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/ResultMapDeSerializer.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/ResultMapDeSerializer.cs?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/ResultMapDeSerializer.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/ResultMapDeSerializer.cs Thu Nov  2 12:46:13 2006
@@ -48,7 +48,7 @@
 		public static ResultMap Deserialize(XmlNode node, ConfigurationScope configScope)
 		{
 			NameValueCollection prop = NodeUtils.ParseAttributes(node, configScope.Properties);
-            ResultMap resultMap = new ResultMap(configScope, prop["id"], prop["class"], prop["extends"]);
+            ResultMap resultMap = new ResultMap(configScope, prop["id"], prop["class"], prop["extends"], prop["groupBy"]);
 
 			configScope.ErrorContext.MoreInfo = "initialize ResultMap";
 

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=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj Thu Nov  2 12:46:13 2006
@@ -517,8 +517,10 @@
     <Compile Include="MappedStatements\ReaderAutoMapper.cs" />
     <Compile Include="MappedStatements\ResultStrategy\AutoMapStrategy.cs" />
     <Compile Include="MappedStatements\ResultStrategy\DictionaryStrategy.cs" />
+    <Compile Include="MappedStatements\ResultStrategy\GroupByStrategy.cs" />
     <Compile Include="MappedStatements\ResultStrategy\IResultStrategy.cs" />
     <Compile Include="MappedStatements\ResultStrategy\ListStrategy.cs" />
+    <Compile Include="MappedStatements\ResultStrategy\MapStrategy.cs" />
     <Compile Include="MappedStatements\ResultStrategy\ObjectStrategy.cs" />
     <Compile Include="MappedStatements\ResultStrategy\ResultClassStrategy.cs" />
     <Compile Include="MappedStatements\ResultStrategy\ResultMapStrategy.cs" />
@@ -666,6 +668,7 @@
     <Content Include="notice.txt" />
     <Content Include="ReadMe.txt" />
     <None Include="IBatisNet.DataMapper.build" />
+    <None Include="MappedStatements\ResultStrategy\ClassDiagram.cd" />
     <EmbeddedResource Include="SqlMap.xsd" />
     <EmbeddedResource Include="SqlMapConfig.xsd" />
   </ItemGroup>

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.csproj
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.csproj?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.csproj (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.csproj Thu Nov  2 12:46:13 2006
@@ -1028,12 +1028,22 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = "MappedStatements\ResultStrategy\GroupByStrategy.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "MappedStatements\ResultStrategy\IResultStrategy.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
                 <File
                     RelPath = "MappedStatements\ResultStrategy\ListStrategy.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "MappedStatements\ResultStrategy\MapStrategy.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/BaseStrategy.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/BaseStrategy.cs?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/BaseStrategy.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/BaseStrategy.cs Thu Nov  2 12:46:13 2006
@@ -23,17 +23,9 @@
  ********************************************************************************/
 #endregion
 
-using System;
-using System.Collections;
 using System.Data;
-using System.Reflection;
-using IBatisNet.Common;
-using IBatisNet.Common.Utilities.Objects;
-using IBatisNet.DataMapper.Commands;
 using IBatisNet.DataMapper.Configuration.ResultMapping;
-using IBatisNet.DataMapper.Exceptions;
 using IBatisNet.DataMapper.Scope;
-using IBatisNet.DataMapper.TypeHandlers;
 
 namespace IBatisNet.DataMapper.MappedStatements
 {

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs Thu Nov  2 12:46:13 2006
@@ -541,7 +541,10 @@
                             while (reader.Read())
                             {
                                 object obj = _resultStrategy.Process(request, ref reader, null);
-                                list.Add(obj);
+                                if (obj!=RequestScope.SKIP)
+                                {
+                                    list.Add(obj);
+                                }
                             }
                         }
                         else

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/DefaultStrategy.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/DefaultStrategy.cs?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/DefaultStrategy.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/DefaultStrategy.cs Thu Nov  2 12:46:13 2006
@@ -82,6 +82,42 @@
 			resultMap.SetValueOfProperty( ref target, mapping, dataBaseValue );
 		}
 
+        /// <summary>
+        /// Gets the value of the specified <see cref="ResultProperty"/> that must be set on the target object.
+        /// </summary>
+        /// <param name="request">The request.</param>
+        /// <param name="resultMap">The result map.</param>
+        /// <param name="mapping">The mapping.</param>
+        /// <param name="reader">The reader.</param>
+        public object Get(RequestScope request, IResultMap resultMap, ResultProperty mapping, IDataReader reader)
+        {
+            if (mapping.TypeHandler == null ||mapping.TypeHandler is UnknownTypeHandler) // Find the TypeHandler
+            {
+                lock (mapping)
+                {
+                    if (mapping.TypeHandler == null || mapping.TypeHandler is UnknownTypeHandler)
+                    {
+                        int columnIndex = 0;
+                        if (mapping.ColumnIndex == ResultProperty.UNKNOWN_COLUMN_INDEX)
+                        {
+                            columnIndex = reader.GetOrdinal(mapping.ColumnName);
+                        }
+                        else
+                        {
+                            columnIndex = mapping.ColumnIndex;
+                        }
+                        Type systemType = ((IDataRecord)reader).GetFieldType(columnIndex);
+
+                        mapping.TypeHandler = request.DataExchangeFactory.TypeHandlerFactory.GetTypeHandler(systemType);
+                    }
+                }
+            }
+
+            object dataBaseValue = mapping.GetDataBaseValue(reader);
+            request.IsRowDataFound = request.IsRowDataFound || (dataBaseValue != null);
+            return dataBaseValue;
+        }
+
 		#endregion
 	}
 }

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/IPropertyStrategy.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/IPropertyStrategy.cs?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/IPropertyStrategy.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/IPropertyStrategy.cs Thu Nov  2 12:46:13 2006
@@ -46,5 +46,15 @@
 		void Set(RequestScope request, IResultMap resultMap, 
 		         ResultProperty mapping, ref object target, 
 		         IDataReader reader, object keys);
+
+
+        /// <summary>
+        /// Gets the value of the specified <see cref="ResultProperty"/> that must be set on the target object.
+        /// </summary>
+        /// <param name="request">The request.</param>
+        /// <param name="resultMap">The result map.</param>
+        /// <param name="mapping">The mapping.</param>
+        /// <param name="reader">The reader.</param>
+        object Get(RequestScope request, IResultMap resultMap, ResultProperty mapping, IDataReader reader);
 	}
 }

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/ResultMapStrategy.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/ResultMapStrategy.cs?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/ResultMapStrategy.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/ResultMapStrategy.cs Thu Nov  2 12:46:13 2006
@@ -23,6 +23,7 @@
  ********************************************************************************/
 #endregion
 
+using System;
 using System.Data;
 using IBatisNet.DataMapper.Configuration.ResultMapping;
 using IBatisNet.DataMapper.Scope;
@@ -51,46 +52,57 @@
 		public void Set(RequestScope request, IResultMap resultMap, 
 			ResultProperty mapping, ref object target, IDataReader reader, object keys)
 		{
-			// Creates object
-			object[] parameters = null;
-			bool isParameterFound = false;
+            object obj = Get(request, resultMap, mapping, reader);
+			// Sets created object on the property
+			resultMap.SetValueOfProperty( ref target, mapping, obj );		
+		}
+
+	    /// <summary>
+        /// Gets the value of the specified <see cref="ResultProperty"/> that must be set on the target object.
+        /// </summary>
+        /// <param name="request">The request.</param>
+        /// <param name="resultMap">The result map.</param>
+        /// <param name="mapping">The mapping.</param>
+        /// <param name="reader">The reader.</param>
+        public object Get(RequestScope request, IResultMap resultMap, ResultProperty mapping, IDataReader reader)
+        {
+            object[] parameters = null;
+            bool isParameterFound = false;
 
             IResultMap resultMapping = mapping.NestedResultMap.ResolveSubMap(reader);
 
             if (resultMapping.Parameters.Count > 0)
-			{
+            {
                 parameters = new object[resultMapping.Parameters.Count];
-				// Fill parameters array
+                // Fill parameters array
                 for (int index = 0; index < resultMapping.Parameters.Count; index++)
-				{
+                {
                     ResultProperty resultProperty = resultMapping.Parameters[index];
                     parameters[index] = resultProperty.ArgumentStrategy.GetValue(request, resultProperty, ref reader, null);
-					request.IsRowDataFound = request.IsRowDataFound || (parameters[index] != null);
-					isParameterFound = isParameterFound || (parameters[index] != null);
-				}
-			}
+                    request.IsRowDataFound = request.IsRowDataFound || (parameters[index] != null);
+                    isParameterFound = isParameterFound || (parameters[index] != null);
+                }
+            }
 
-			object obj = null;
-			// If I have a constructor tag and all argumments values are null, the obj is null
+            object obj = null;
+            // If I have a constructor tag and all argumments values are null, the obj is null
             if (resultMapping.Parameters.Count > 0 && isParameterFound == false)
-			{
-				obj = null;
-			}
-			else
-			{
+            {
+                obj = null;
+            }
+            else
+            {
                 obj = resultMapping.CreateInstanceOfResult(parameters);
-				
-				// Fills properties on the new object
-                if (this.FillObjectWithReaderAndResultMap(request, reader, resultMapping, obj) == false)
-				{
-					obj = null;
-				}				
-			}
-
-			// Sets created object on the property
-			resultMap.SetValueOfProperty( ref target, mapping, obj );		
-		}
 
+                // Fills properties on the new object
+                if (this.FillObjectWithReaderAndResultMap(request, reader, resultMapping, obj) == false)
+                {
+                    obj = null;
+                }
+            }
+	        
+	        return obj;
+        }
 		#endregion
 	}
 }

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectArrayStrategy.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectArrayStrategy.cs?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectArrayStrategy.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectArrayStrategy.cs Thu Nov  2 12:46:13 2006
@@ -69,6 +69,17 @@
 			request.QueueSelect.Enqueue(postSelect);
 		}
 
+        /// <summary>
+        /// Gets the value of the specified <see cref="ResultProperty"/> that must be set on the target object.
+        /// </summary>
+        /// <param name="request">The request.</param>
+        /// <param name="resultMap">The result map.</param>
+        /// <param name="mapping">The mapping.</param>
+        /// <param name="reader">The reader.</param>
+        public object Get(RequestScope request, IResultMap resultMap, ResultProperty mapping, IDataReader reader)
+        {
+            throw new NotSupportedException("Get method on ResultMapStrategy is not supported");
+        }
 		#endregion
 	}
 }

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectGenericListStrategy.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectGenericListStrategy.cs?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectGenericListStrategy.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectGenericListStrategy.cs Thu Nov  2 12:46:13 2006
@@ -81,6 +81,17 @@
 
         }
 
+        /// <summary>
+        /// Gets the value of the specified <see cref="ResultProperty"/> that must be set on the target object.
+        /// </summary>
+        /// <param name="request">The request.</param>
+        /// <param name="resultMap">The result map.</param>
+        /// <param name="mapping">The mapping.</param>
+        /// <param name="reader">The reader.</param>
+        public object Get(RequestScope request, IResultMap resultMap, ResultProperty mapping, IDataReader reader)
+        {
+            throw new NotSupportedException("Get method on ResultMapStrategy is not supported");
+        }        
         #endregion
     }
 }

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectListStrategy.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectListStrategy.cs?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectListStrategy.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectListStrategy.cs Thu Nov  2 12:46:13 2006
@@ -83,6 +83,17 @@
 
 		}
 
+        /// <summary>
+        /// Gets the value of the specified <see cref="ResultProperty"/> that must be set on the target object.
+        /// </summary>
+        /// <param name="request">The request.</param>
+        /// <param name="resultMap">The result map.</param>
+        /// <param name="mapping">The mapping.</param>
+        /// <param name="reader">The reader.</param>
+        public object Get(RequestScope request, IResultMap resultMap, ResultProperty mapping, IDataReader reader)
+        {
+            throw new NotSupportedException("Get method on ResultMapStrategy is not supported");
+        }
 		#endregion
 	}
 }

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectObjectStrategy.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectObjectStrategy.cs?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectObjectStrategy.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectObjectStrategy.cs Thu Nov  2 12:46:13 2006
@@ -68,6 +68,17 @@
 			request.QueueSelect.Enqueue(postSelect);
 		}
 
+        /// <summary>
+        /// Gets the value of the specified <see cref="ResultProperty"/> that must be set on the target object.
+        /// </summary>
+        /// <param name="request">The request.</param>
+        /// <param name="resultMap">The result map.</param>
+        /// <param name="mapping">The mapping.</param>
+        /// <param name="reader">The reader.</param>
+        public object Get(RequestScope request, IResultMap resultMap, ResultProperty mapping, IDataReader reader)
+        {
+            throw new NotSupportedException("Get method on ResultMapStrategy is not supported");
+        }	    
 		#endregion
 	}
 }

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectStrategy.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectStrategy.cs?view=diff&rev=470514&r1=470513&r2=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectStrategy.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectStrategy.cs Thu Nov  2 12:46:13 2006
@@ -146,6 +146,17 @@
 			}		
 		}
 
+        /// <summary>
+        /// Gets the value of the specified <see cref="ResultProperty"/> that must be set on the target object.
+        /// </summary>
+        /// <param name="request">The request.</param>
+        /// <param name="resultMap">The result map.</param>
+        /// <param name="mapping">The mapping.</param>
+        /// <param name="reader">The reader.</param>
+        public object Get(RequestScope request, IResultMap resultMap, ResultProperty mapping, IDataReader reader)
+        {
+            throw new NotSupportedException("Get method on ResultMapStrategy is not supported");
+        }	    
 		#endregion
 	}
 }

Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/ClassDiagram.cd
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/ClassDiagram.cd?view=auto&rev=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/ClassDiagram.cd (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/ClassDiagram.cd Thu Nov  2 12:46:13 2006
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ClassDiagram MajorVersion="1" MinorVersion="1">
+  <Font Name="Tahoma" Size="8.25" />
+  <Comment CommentText="Determines how a record will ne map. &#xD;&#xA;If we have specify a resutlMap tag on the statement tag then use the MapStrategy&#xD;&#xA;If we have specify a resultClass tag on the statement tag then use the ResultClassStrategy&#xD;&#xA;else use the ObjectStrategy">
+    <Position X="7.625" Y="0.5" Height="0.979" Width="3.117" />
+  </Comment>
+  <Comment CommentText="The ResultClassStrategy delegates to an other IResultStrategy based on the class type.&#xD;&#xA;With a &quot;primitive&quot; type use the SimpleTypeStrategy&#xD;&#xA;With an IList class use the ListStrategy&#xD;&#xA;With an IDictionary use the DictionayStrategy&#xD;&#xA;else use an AutoMapStrategy">
+    <Position X="4.875" Y="3.969" Height="0.948" Width="3.033" />
+  </Comment>
+  <Comment CommentText="When use an resultMap tag, delegates on the ResultMapStrategy or GroupByStrategy based on the groupBy attribute.">
+    <Position X="0.5" Y="2.177" Height="0.75" Width="1.7" />
+  </Comment>
+  <Class Name="IBatisNet.DataMapper.MappedStatements.ResultStrategy.AutoMapStrategy" Collapsed="true">
+    <Position X="7.25" Y="6.25" Width="1.75" />
+    <TypeIdentifier>
+      <FileName>MappedStatements\ResultStrategy\AutoMapStrategy.cs</FileName>
+      <HashCode>AAAAAAAAAAAAAAAAAgAAAAAAIAAAAAACAAAAAAAAAAA=</HashCode>
+    </TypeIdentifier>
+    <Lollipop Position="0.2" />
+  </Class>
+  <Class Name="IBatisNet.DataMapper.MappedStatements.ResultStrategy.DictionaryStrategy" Collapsed="true">
+    <Position X="6.5" Y="5.5" Width="1.75" />
+    <TypeIdentifier>
+      <FileName>MappedStatements\ResultStrategy\DictionaryStrategy.cs</FileName>
+      <HashCode>AAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+    </TypeIdentifier>
+    <Lollipop Position="0.2" />
+  </Class>
+  <Class Name="IBatisNet.DataMapper.MappedStatements.ResultStrategy.ListStrategy" Collapsed="true">
+    <Position X="4.5" Y="5.5" Width="1.5" />
+    <TypeIdentifier>
+      <FileName>MappedStatements\ResultStrategy\ListStrategy.cs</FileName>
+      <HashCode>AAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+    </TypeIdentifier>
+    <Lollipop Position="0.2" />
+  </Class>
+  <Class Name="IBatisNet.DataMapper.MappedStatements.ResultStrategy.ObjectStrategy" Collapsed="true">
+    <Position X="9.25" Y="3.25" Width="1.5" />
+    <TypeIdentifier>
+      <FileName>MappedStatements\ResultStrategy\ObjectStrategy.cs</FileName>
+      <HashCode>AAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+    </TypeIdentifier>
+    <Lollipop Position="0.2" />
+  </Class>
+  <Class Name="IBatisNet.DataMapper.MappedStatements.ResultStrategy.ResultClassStrategy" Collapsed="true">
+    <Position X="5.25" Y="3.25" Width="1.75" />
+    <TypeIdentifier>
+      <FileName>MappedStatements\ResultStrategy\ResultClassStrategy.cs</FileName>
+      <HashCode>AAAAAAAAAEAAAAAIAgAAAAAAAAAAAAAAAAAABABAAAA=</HashCode>
+    </TypeIdentifier>
+    <Lollipop Position="0.2" />
+  </Class>
+  <Class Name="IBatisNet.DataMapper.MappedStatements.ResultStrategy.ResultMapStrategy" Collapsed="true">
+    <Position X="0.5" Y="4.25" Width="1.75" />
+    <TypeIdentifier>
+      <FileName>MappedStatements\ResultStrategy\ResultMapStrategy.cs</FileName>
+      <HashCode>AAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+    </TypeIdentifier>
+    <Lollipop Position="0.2" />
+  </Class>
+  <Class Name="IBatisNet.DataMapper.MappedStatements.ResultStrategy.ResultStrategyFactory" Collapsed="true">
+    <Position X="5.25" Y="0.5" Width="1.75" />
+    <TypeIdentifier>
+      <FileName>MappedStatements\ResultStrategy\ResultStrategyFactory.cs</FileName>
+      <HashCode>AAAAAAAAAAAAAABAAAAAAAAAIAABAAAAAAAEAAAAAAA=</HashCode>
+    </TypeIdentifier>
+    <Compartments>
+      <Compartment Name="Fields" Collapsed="true" />
+      <Compartment Name="Methods" Collapsed="true" />
+    </Compartments>
+  </Class>
+  <Class Name="IBatisNet.DataMapper.MappedStatements.ResultStrategy.SimpleTypeStrategy" Collapsed="true">
+    <Position X="3.25" Y="6.25" Width="1.75" />
+    <TypeIdentifier>
+      <FileName>MappedStatements\ResultStrategy\SimpleTypeStrategy.cs</FileName>
+      <HashCode>AAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+    </TypeIdentifier>
+    <Lollipop Position="0.2" />
+  </Class>
+  <Class Name="IBatisNet.DataMapper.MappedStatements.ResultStrategy.MapStrategy" Collapsed="true">
+    <Position X="1.5" Y="3.25" Width="1.5" />
+    <TypeIdentifier>
+      <FileName>MappedStatements\ResultStrategy\MapStrategy.cs</FileName>
+      <HashCode>AAAAEAAIAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+    </TypeIdentifier>
+    <Lollipop Position="0.2" />
+  </Class>
+  <Class Name="IBatisNet.DataMapper.MappedStatements.ResultStrategy.GroupByStrategy" Collapsed="true">
+    <Position X="2.5" Y="4.25" Width="1.5" />
+    <TypeIdentifier>
+      <FileName>MappedStatements\ResultStrategy\GroupByStrategy.cs</FileName>
+      <HashCode>AAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+    </TypeIdentifier>
+    <Lollipop Position="0.2" />
+  </Class>
+  <Interface Name="IBatisNet.DataMapper.MappedStatements.ResultStrategy.IResultStrategy">
+    <Position X="5.5" Y="1.5" Width="1.5" />
+    <TypeIdentifier>
+      <FileName>MappedStatements\ResultStrategy\IResultStrategy.cs</FileName>
+      <HashCode>AAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
+    </TypeIdentifier>
+  </Interface>
+</ClassDiagram>
\ No newline at end of file

Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/GroupByStrategy.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/GroupByStrategy.cs?view=auto&rev=470514
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/GroupByStrategy.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/GroupByStrategy.cs Thu Nov  2 12:46:13 2006
@@ -0,0 +1,203 @@
+#region Apache Notice
+/*****************************************************************************
+ * $Revision: 374175 $
+ * $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
+
+using System;
+using System.Collections;
+#if dotnet2
+using System.Collections.Generic;
+#endif
+using System.Data;
+using System.Text;
+using IBatisNet.Common.Utilities.Objects;
+using IBatisNet.Common.Utilities.Objects.Members;
+using IBatisNet.DataMapper.Configuration.ResultMapping;
+using IBatisNet.DataMapper.Scope;
+
+namespace IBatisNet.DataMapper.MappedStatements.ResultStrategy
+{
+    /// <summary>
+    /// <see cref="IResultStrategy"/> implementation when 
+    /// a 'groupBy' attribute is specified on the resultMap tag.
+    /// </summary>
+    public sealed class GroupByStrategy : BaseStrategy, IResultStrategy
+    {
+        private const string KEY_SEPARATOR = "\002";
+
+        // il fait des pushRequest, popRequest à voir quoi cela sert
+        // il faudrait faire un push de l currentKey au début de process ? 
+        // un pop à la fin de process  ?
+        private string GetUniqueKey(IResultMap resultMap, RequestScope request, IDataReader reader)
+        {
+            if (resultMap.GroupByProperties.Count > 0)
+            {
+                StringBuilder keyBuffer = new StringBuilder();
+
+                for (int i = 0; i < resultMap.Properties.Count; i++)
+                {
+                    ResultProperty resultProperty = resultMap.Properties[i];
+                    if (resultMap.GroupByProperties.Contains(resultProperty.PropertyName))
+                    {
+                        // on peut surement utiliser resultProperty.GetDataBaseValue
+                        keyBuffer.Append(resultProperty.PropertyStrategy.Get(request, resultMap, resultProperty, reader));
+                        keyBuffer.Append('-');
+                    }
+                }
+
+                if (keyBuffer.Length < 1)
+                {
+                    return null;
+                }
+                else
+                {
+                    // separator value not likely to appear in a database
+                    keyBuffer.Append(KEY_SEPARATOR);
+                    return keyBuffer.ToString();
+                }
+            }
+            else
+            {
+                return null;
+            }
+        }
+
+        #region IResultStrategy Members
+
+        /// <summary>
+        /// Processes the specified <see cref="IDataReader"/>.
+        /// </summary>
+        /// <param name="request">The request.</param>
+        /// <param name="reader">The reader.</param>
+        /// <param name="resultObject">The result object.</param>
+        /// <returns>The result object</returns>
+        public object Process(RequestScope request, ref IDataReader reader, object resultObject)
+        {
+            object outObject = resultObject;
+
+            IResultMap resultMap = request.CurrentResultMap.ResolveSubMap(reader);
+
+            string uniqueKey = GetUniqueKey(resultMap, request, reader);
+            // Gets the [key, result object] already build
+            IDictionary buildObjects = request.GetUniqueKeys(resultMap);
+
+            if (buildObjects != null && buildObjects.Contains(uniqueKey))
+            {
+                // Unique key is already known, so get the existing result object and process additional results.
+                outObject = buildObjects[uniqueKey];
+                // process additional property with resulMapping attribute
+                for (int index = 0; index < resultMap.Properties.Count; index++)
+                {
+                    ResultProperty resultProperty = resultMap.Properties[index];
+                    if (resultProperty.PropertyStrategy is PropertyStrategy.ResultMapStrategy)
+                    {
+                        // the ResultProperty is an IList implementation 
+                        if (typeof(IList).IsAssignableFrom(resultProperty.SetAccessor.MemberType))
+                        {
+                            // appel PropertyStrategy.ResultMapStrategy.Get
+                            object result = resultProperty.PropertyStrategy.Get(request, resultMap, resultProperty, reader);
+                            IList list = (IList)ObjectProbe.GetMemberValue(outObject, resultProperty.PropertyName,
+                                                       request.DataExchangeFactory.AccessorFactory);
+                            list.Add(result);
+                        }
+                        else
+                        {
+                            resultProperty.PropertyStrategy.Set(request, resultMap, resultProperty, ref outObject, reader, null);
+                        }
+                    }
+                }
+                outObject = RequestScope.SKIP;
+            }
+            else if (uniqueKey == null || buildObjects == null || !buildObjects.Contains(uniqueKey))
+            {
+                // Unique key is NOT known, so create a new result object and process additional results.
+
+                // temp ?, we don't support constructor tag with groupBy attribute
+                outObject = resultMap.CreateInstanceOfResult(null);
+
+                for (int index = 0; index < resultMap.Properties.Count; index++)
+                {
+                    ResultProperty resultProperty = resultMap.Properties[index];
+#if dotnet2
+                    if (resultProperty.MemberType.IsGenericType &&
+                        typeof(IList<>).IsAssignableFrom(resultProperty.MemberType.GetGenericTypeDefinition()))
+                    {
+                        object result = resultProperty.PropertyStrategy.Get(request, resultMap, resultProperty, reader);
+                        object property = ObjectProbe.GetMemberValue(outObject, resultProperty.PropertyName,
+                                                   request.DataExchangeFactory.AccessorFactory);
+                        if (property == null)// Create the list
+                        {
+                            IFactory factory = request.DataExchangeFactory.ObjectFactory.CreateFactory(resultProperty.MemberType,
+                                                                                                       Type.EmptyTypes);
+                            property = factory.CreateInstance(Type.EmptyTypes);
+                            resultProperty.SetAccessor.Set(outObject, property);
+                        }
+
+                        IList list = (IList)property;
+                        list.Add(result);
+                    }
+                    else
+#endif
+                        if (typeof(IList).IsAssignableFrom(resultProperty.MemberType))
+                        {
+                            object result = resultProperty.PropertyStrategy.Get(request, resultMap, resultProperty, reader);
+                            object property = ObjectProbe.GetMemberValue(outObject, resultProperty.PropertyName,
+                                                       request.DataExchangeFactory.AccessorFactory);
+                            if (property == null)// Create the list
+                            {
+                                if (resultProperty.MemberType == typeof(IList))
+                                {
+                                    property = new ArrayList(); 
+                                }
+                                else // custom collection
+                                {
+                                    IFactory factory = request.DataExchangeFactory.ObjectFactory.CreateFactory(resultProperty.MemberType,
+                                                                             Type.EmptyTypes);
+                                    property = factory.CreateInstance(Type.EmptyTypes);
+                                }
+                                resultProperty.SetAccessor.Set(outObject, property);
+                            }
+
+                            IList list = (IList)property;
+                            list.Add(result);
+                        }
+                        else
+                        {
+                            resultProperty.PropertyStrategy.Set(request, resultMap, resultProperty, ref outObject, reader, null);
+                        }
+                }
+
+                if (buildObjects == null)
+                {
+                    buildObjects = new Hashtable();
+                    request.SetUniqueKeys(resultMap, buildObjects);
+                }
+                buildObjects[uniqueKey] = outObject;
+            }
+
+            return outObject;
+        }
+
+        #endregion
+    }
+}

Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/GroupByStrategy.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/GroupByStrategy.cs
------------------------------------------------------------------------------
    svn:keywords = Id LastChangedDate LastChangedBy