ibatis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gba...@apache.org
Subject svn commit: r377813 - in /ibatis/trunk/cs/mapper: IBatisNet.DataMapper.Test/ IBatisNet.DataMapper.Test/Domain/ IBatisNet.DataMapper.Test/Maps/Access/OleDb/ IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/ IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/ IBatisNet...
Date Tue, 14 Feb 2006 20:07:29 GMT
Author: gbayon
Date: Tue Feb 14 12:07:27 2006
New Revision: 377813

URL: http://svn.apache.org/viewcvs?rev=377813&view=rev
Log:
- Updated generic list support for object as  Order{public IList<LineItem> LineItemsGenericList{...}};
- Added unit test
- Updated change log

Added:
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Generics/ResiltMapTest.cs
  (with props)
Modified:
    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/Maps/Access/OleDb/Order.xml
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Order.xml
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Order.xml
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Order.xml
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/ByteFx/Order.xml
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/MySql/Order.xml
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Order.xml
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/OracleClient/Order.xml
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/PostgreSQL/Npgsql/Order.xml
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/BaseTest.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/ReadMe.txt
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/ChangeLog.txt
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Order.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Order.cs?rev=377813&r1=377812&r2=377813&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Order.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Order.cs Tue Feb 14 12:07:27 2006
@@ -1,5 +1,8 @@
 using System;
 using System.Collections;
+#if dotnet2
+using System.Collections.Generic;
+#endif
 
 namespace IBatisNet.DataMapper.Test.Domain
 {
@@ -22,42 +25,31 @@
 		private IList _lineItems;//LineItemCollection
 		private LineItem[] _lineItemsArray;
 		private LineItem _favouriteLineItem;
+        private IList<LineItem> _genericList;
+
+        public IList<LineItem> LineItemsGenericList
+        {
+            get { return _genericList; }
+            set { _genericList = value; }
+        }
 
 		public LineItem FavouriteLineItem
 		{
-			get
-			{
-				return _favouriteLineItem; 
-			}
-			set
-			{ 
-				_favouriteLineItem = value; 
-			}
+			get { return _favouriteLineItem; }
+			set { _favouriteLineItem = value; }
 		}
 
 		public IList LineItemsIList
 		{
-			get
-			{
-				return _lineItemsIList; 
-			}
-			set
-			{ 
-				_lineItemsIList = value; 
-			}
+			get { return _lineItemsIList; }
+			set { _lineItemsIList = value; }
 		}
 
 
 		public IList LineItems
 		{
-			get
-			{
-				return _lineItems; 
-			}
-			set
-			{ 
-				_lineItems = value; 
-			}
+			get { return _lineItems; }
+			set { _lineItems = value; }
 		}
 
 		public LineItem[] LineItemsArray
@@ -180,7 +172,7 @@
 			}
 		}
 
-		public System.DateTime Date
+		public DateTime Date
 		{
 			get
 			{
@@ -192,7 +184,7 @@
 			}
 		}
 
-		public System.DateTime OrderDate {
+		public DateTime OrderDate {
 			get {
 				return _date; 
 			}

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.2005.csproj
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.2005.csproj?rev=377813&r1=377812&r2=377813&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.2005.csproj
(original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.2005.csproj
Tue Feb 14 12:07:27 2006
@@ -211,6 +211,7 @@
     <Compile Include="NUnit\SqlMapTests\DynamicTest.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="NUnit\SqlMapTests\Generics\ResiltMapTest.cs" />
     <Compile Include="NUnit\SqlMapTests\Generics\ResultClassTest.cs" />
     <Compile Include="NUnit\SqlMapTests\Generics\StatementTest.cs" />
     <Compile Include="NUnit\SqlMapTests\InheritanceTest.cs">

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Order.xml
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Order.xml?rev=377813&r1=377812&r2=377813&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Order.xml (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Access/OleDb/Order.xml Tue Feb 14
12:07:27 2006
@@ -16,7 +16,12 @@
 		<resultMap id="credit-card-result" class="string">
 			<result property="value" column="Order_CardNumber"/>
 		</resultMap>
-  
+
+    <resultMap id="order-with-generic-list-lineitem" class="Order" 
+            extends="lite-order-result-by-name" >
+      <result property="LineItemsGenericList" column="Order_ID" select="GetLineItemsForOrder"
/>
+    </resultMap>
+    
 		<resultMap id="order-with-lines-result" class="Order" 
 								extends="lite-order-result-by-name" >
 			<result property="LineItemsIList" lazyLoad="true" column="Order_ID" select="GetLineItemsForOrder"
/>

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Order.xml
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Order.xml?rev=377813&r1=377812&r2=377813&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Order.xml (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/Odbc/Order.xml Tue Feb 14
12:07:27 2006
@@ -16,7 +16,12 @@
 		<resultMap id="credit-card-result" class="string">
 			<result property="value" column="Order_CardNumber"/>
 		</resultMap>
-  
+
+    <resultMap id="order-with-generic-list-lineitem" class="Order" 
+            extends="lite-order-result-by-name" >
+      <result property="LineItemsGenericList" column="Order_ID" select="GetLineItemsForOrder"
/>
+    </resultMap>
+    
 		<resultMap id="order-with-lines-result" class="Order" 
 								extends="lite-order-result-by-name" >
 			<result property="LineItemsIList" lazyLoad="true" column="Order_ID" select="GetLineItemsForOrder"
/>
@@ -201,6 +206,12 @@
 	
 	<statements>
 
+    <statement id="GetOrderWithGenricListLineItem"
+      parameterClass="Integer"
+      resultMap="order-with-generic-list-lineitem" >
+          select * from Orders where Order_ID = #value#
+    </statement>
+    
 		<statement id="GetOrderByHashTable"
 					parameterClass="Int"
 					resultMap="order-hash" >

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Order.xml
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Order.xml?rev=377813&r1=377812&r2=377813&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Order.xml (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/OleDb/Order.xml Tue Feb 14
12:07:27 2006
@@ -16,7 +16,12 @@
 		<resultMap id="credit-card-result" class="string">
 			<result property="value" column="Order_CardNumber"/>
 		</resultMap>
-  
+
+    <resultMap id="order-with-generic-list-lineitem" class="Order" 
+        extends="lite-order-result-by-name" >
+      <result property="LineItemsGenericList" column="Order_ID" select="GetLineItemsForOrder"
/>
+    </resultMap>
+    
 		<resultMap id="order-with-lines-result" class="Order" 
 								extends="lite-order-result-by-name" >
 			<result property="LineItemsIList" lazyLoad="true" column="Order_ID" select="GetLineItemsForOrder"
/>
@@ -206,7 +211,13 @@
 					resultMap="lite-order-result-by-name" >
 			select * from Orders where Order_ID = #value#
 		</statement>
-		
+
+    <statement id="GetOrderWithGenricListLineItem"
+      parameterClass="Integer"
+      resultMap="order-with-generic-list-lineitem" >
+          select * from Orders where Order_ID = #value#
+    </statement>
+    
 		<statement id="GetOrderLiteByColumnIndex"
 					parameterClass="Int"
 					resultMap="lite-order-result-by-index" >

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Order.xml
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Order.xml?rev=377813&r1=377812&r2=377813&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Order.xml (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Order.xml Tue Feb
14 12:07:27 2006
@@ -18,28 +18,45 @@
 			<result property="value" column="Order_CardNumber"/>
 		</resultMap>
 
-		<resultMap id="order-with-lines-result" class="Order" 
+    <resultMap id="lite-order-result-by-name" class="Order">
+      <result property="Id"         column="Order_ID"/>
+      <result property="Date"       column="Order_Date" nullValue="01/01/0001 00:00:00"/>
+      <result property="CardExpiry" column="Order_CardExpiry"/>
+      <result property="CardType"   column="Order_CardType"/>
+      <result property="CardNumber" column="Order_CardNumber"/>
+      <result property="Street"     column="Order_Street"/>
+      <result property="City"       column="Order_City"/>
+      <result property="Province"   column="Order_Province"/>
+      <result property="PostalCode" column="Order_PostalCode"/>
+    </resultMap>
+
+    <resultMap id="order-with-generic-list-lineitem" class="Order" 
+            extends="lite-order-result-by-name" >
+        <result property="LineItemsGenericList" column="Order_ID" select="GetLineItemsForOrder"
/>
+    </resultMap>
+    
+    <resultMap id="order-with-lines-result" class="Order" 
 								extends="lite-order-result-by-name" >
-			<result property="LineItemsIList" lazyLoad="true" column="Order_ID" select="GetLineItemsForOrder"
/>
-		</resultMap>
-		
-		<resultMap id="order-with-lines-result-statement-namespaces" class="Order" 
+        <result property="LineItemsIList" lazyLoad="true" column="Order_ID" select="GetLineItemsForOrder"
/>
+    </resultMap>
+
+    <resultMap id="order-with-lines-result-statement-namespaces" class="Order" 
 								extends="lite-order-result-by-name" >
-			<result property="LineItemsIList" lazyLoad="true" column="Order_ID" select="LineItem.GetLineItemsForOrder"
/>
-		</resultMap>		
-		
-		<resultMap id="order-with-lines-collection" class="Order"
+        <result property="LineItemsIList" lazyLoad="true" column="Order_ID" select="LineItem.GetLineItemsForOrder"
/>
+    </resultMap>
+
+    <resultMap id="order-with-lines-collection" class="Order"
 								extends="lite-order-result-by-name" >
-			<result property="LineItems" column="Order_ID"  lazyLoad="true" select="GetLineItemsForOrderWithListClass"
/>
-		</resultMap>
-		
-		<resultMap id="order-with-lines-array" class="Order"
+        <result property="LineItems" column="Order_ID"  lazyLoad="true" select="GetLineItemsForOrderWithListClass"
/>
+    </resultMap>
+
+    <resultMap id="order-with-lines-array" class="Order"
 								extends="lite-order-result-by-name">
-			<result property="LineItemsArray" column="Order_ID" select="GetLineItemsForOrder"/>
-		</resultMap>
-  
-		<resultMap id="lite-order-map-result" class="Hashtable">
-			<result property="Id"         type="Int" column="Order_ID"/>
+        <result property="LineItemsArray" column="Order_ID" select="GetLineItemsForOrder"/>
+    </resultMap>
+
+    <resultMap id="lite-order-map-result" class="Hashtable">
+      <result property="Id"         type="Int" column="Order_ID"/>
 			<result property="Date"       type="date" column="Order_Date"/>
 			<result property="CardExpiry" type="string" column="Order_CardExpiry"/>
 			<result property="CardType"   type="string" column="Order_CardType"/>
@@ -50,18 +67,7 @@
 			<result property="PostalCode" type="string" column="Order_PostalCode"/>
 		</resultMap>
   
-		<resultMap id="lite-order-result-by-name" class="Order">
-			<result property="Id"         column="Order_ID"/>
-			<result property="Date"       column="Order_Date" nullValue="01/01/0001 00:00:00"/>
-			<result property="CardExpiry" column="Order_CardExpiry"/>
-			<result property="CardType"   column="Order_CardType"/>
-			<result property="CardNumber" column="Order_CardNumber"/>
-			<result property="Street"     column="Order_Street"/>
-			<result property="City"       column="Order_City"/>
-			<result property="Province"   column="Order_Province"/>
-			<result property="PostalCode" column="Order_PostalCode"/>
-		</resultMap>
-		
+	
 		<resultMap id="order-hash" class="Hashtable">
 			<result property="Date"       column="Order_Date" nullValue="01/01/0001 00:00:00"/>
 		</resultMap>
@@ -213,7 +219,9 @@
 						AND Orders.Order_FavouriteLineItem = LineItems.LineItem_ID
 			WHERE     Orders.Order_ID = #value#
 		</select>-->
-		
+
+
+    
 		<statement id="GetOrderLiteByColumnName"
 					parameterClass="Int"
 					resultMap="lite-order-result-by-name" >
@@ -253,7 +261,13 @@
 					resultMap="order-with-lines-result" >
 			select * from Orders where Order_ID = #value#
 		</statement>
-		
+
+    <statement id="GetOrderWithGenricListLineItem"
+      parameterClass="Integer"
+      resultMap="order-with-generic-list-lineitem" >
+      select * from Orders where Order_ID = #value#
+    </statement>
+    
 		<statement id="GetOrderWithLineItemsUsingStatementNamespaces"
 					parameterClass="Integer"
 					resultMap="order-with-lines-result-statement-namespaces" >

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/ByteFx/Order.xml
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/ByteFx/Order.xml?rev=377813&r1=377812&r2=377813&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/ByteFx/Order.xml (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/ByteFx/Order.xml Tue Feb 14
12:07:27 2006
@@ -16,7 +16,12 @@
 		<resultMap id="credit-card-result" class="string">
 			<result property="value" column="Order_CardNumber"/>
 		</resultMap>
-		<!--  -->
+
+    <resultMap id="order-with-generic-list-lineitem" class="Order" 
+        extends="lite-order-result-by-name" >
+      <result property="LineItemsGenericList" column="Order_ID" select="GetLineItemsForOrder"
/>
+    </resultMap>
+    
 		<resultMap id="order-with-lines-result" class="Order" 
 								extends="lite-order-result-by-name" >
 			<result property="LineItemsIList" lazyLoad="true" column="Order_ID" select="GetLineItemsForOrder"
/>
@@ -188,7 +193,13 @@
 	</resultMaps>  
 	
 	<statements>
-	
+
+    <statement id="GetOrderWithGenricListLineItem"
+      parameterClass="Integer"
+      resultMap="order-with-generic-list-lineitem" >
+          select * from Orders where Order_ID = #value#
+    </statement>
+    
 		<statement id="GetOrderByHashTable"
 					parameterClass="Int"
 					resultMap="order-hash" >

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/MySql/Order.xml
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/MySql/Order.xml?rev=377813&r1=377812&r2=377813&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/MySql/Order.xml (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MySql/MySql/Order.xml Tue Feb 14
12:07:27 2006
@@ -16,8 +16,13 @@
 		<resultMap id="credit-card-result" class="string">
 			<result property="value" column="Order_CardNumber"/>
 		</resultMap>
-		<!--  -->
-		<resultMap id="order-with-lines-result" class="Order" 
+
+    <resultMap id="order-with-generic-list-lineitem" class="Order" 
+           extends="lite-order-result-by-name" >
+      <result property="LineItemsGenericList" column="Order_ID" select="GetLineItemsForOrder"
/>
+    </resultMap>
+    
+    <resultMap id="order-with-lines-result" class="Order" 
 								extends="lite-order-result-by-name" >
 			<result property="LineItemsIList" lazyLoad="true" column="Order_ID" select="GetLineItemsForOrder"
/>
 		</resultMap>
@@ -188,6 +193,13 @@
 	</resultMaps>  
 	
 	<statements>
+
+    <statement id="GetOrderWithGenricListLineItem"
+      parameterClass="Integer"
+      resultMap="order-with-generic-list-lineitem" >
+      select * from Orders where Order_ID = #value#
+    </statement>
+    
 		<statement id="GetOrderLiteByColumnName"
 					parameterClass="Int"
 					resultMap="lite-order-result-by-name" >

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Order.xml
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Order.xml?rev=377813&r1=377812&r2=377813&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Order.xml (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/ODP/Order.xml Tue Feb 14
12:07:27 2006
@@ -17,6 +17,11 @@
 			<result property="value" column="Order_CardNumber" dbType="Varchar2" />
 		</resultMap>
 
+    <resultMap id="order-with-generic-list-lineitem" class="Order" 
+            extends="lite-order-result-by-name" >
+      <result property="LineItemsGenericList" column="Order_ID" select="GetLineItemsForOrder"
/>
+    </resultMap>
+    
 		<resultMap id="order-with-lines-result" class="Order" 
 								extends="lite-order-result-by-name" >
 			<result property="LineItemsIList" lazyLoad="true" column="Order_ID" select="GetLineItemsForOrder"
/>
@@ -188,7 +193,12 @@
 	</resultMaps>  
 	
 	<statements>
-	
+    <statement id="GetOrderWithGenricListLineItem"
+      parameterClass="Integer"
+      resultMap="order-with-generic-list-lineitem" >
+      select * from Orders where Order_ID = #value#
+    </statement>
+    
 		<statement id="GetOrderByHashTable"
 					parameterClass="Int"
 					resultMap="order-hash" >

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/OracleClient/Order.xml
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/OracleClient/Order.xml?rev=377813&r1=377812&r2=377813&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/OracleClient/Order.xml (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/Oracle/OracleClient/Order.xml Tue
Feb 14 12:07:27 2006
@@ -16,7 +16,12 @@
 		<resultMap id="credit-card-result" class="string">
 			<result property="value" column="Order_CardNumber"/>
 		</resultMap>
-		
+
+    <resultMap id="order-with-generic-list-lineitem" class="Order" 
+           extends="lite-order-result-by-name" >
+      <result property="LineItemsGenericList" column="Order_ID" select="GetLineItemsForOrder"
/>
+    </resultMap>
+    
 		<resultMap id="order-with-lines-result" class="Order" 
 								extends="lite-order-result-by-name" >
 			<result property="LineItemsIList" lazyLoad="true" column="Order_ID" select="GetLineItemsForOrder"
/>
@@ -188,7 +193,13 @@
 	</resultMaps>  
 	
 	<statements>
-	
+
+    <statement id="GetOrderWithGenricListLineItem"
+      parameterClass="Integer"
+      resultMap="order-with-generic-list-lineitem" >
+          select * from Orders where Order_ID = #value#
+    </statement>
+    
 		<statement id="GetOrderByHashTable"
 					parameterClass="Int"
 					resultMap="order-hash" >

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/PostgreSQL/Npgsql/Order.xml
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/PostgreSQL/Npgsql/Order.xml?rev=377813&r1=377812&r2=377813&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/PostgreSQL/Npgsql/Order.xml (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/PostgreSQL/Npgsql/Order.xml Tue
Feb 14 12:07:27 2006
@@ -16,8 +16,13 @@
 		<resultMap id="credit-card-result" class="string">
 			<result property="value" column="Order_CardNumber"/>
 		</resultMap>
-		<!--  -->
-		<resultMap id="order-with-lines-result" class="Order" 
+
+    <resultMap id="order-with-generic-list-lineitem" class="Order" 
+            extends="lite-order-result-by-name" >
+      <result property="LineItemsGenericList" column="Order_ID" select="GetLineItemsForOrder"
/>
+    </resultMap>
+    
+    <resultMap id="order-with-lines-result" class="Order" 
 								extends="lite-order-result-by-name" >
 			<result property="LineItemsIList" lazyLoad="true" column="Order_ID" select="GetLineItemsForOrder"
/>
 		</resultMap>
@@ -188,7 +193,12 @@
 	</resultMaps>  
 	
 	<statements>
-	
+    <statement id="GetOrderWithGenricListLineItem"
+      parameterClass="Integer"
+      resultMap="order-with-generic-list-lineitem" >
+      select * from Orders where Order_ID = #value#
+    </statement>
+    
 		<statement id="GetOrderByHashTable"
 					parameterClass="Int"
 					resultMap="order-hash" >

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/BaseTest.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/BaseTest.cs?rev=377813&r1=377812&r2=377813&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 Feb
14 12:07:27 2006
@@ -67,7 +67,14 @@
 			string fileName = "sqlmap" + "_" + ConfigurationSettings.AppSettings["database"] + "_"
+ ConfigurationSettings.AppSettings["providerType"] + ".config";
 
 #endif
-            sqlMap = builder.Configure(fileName);
+            try
+            {
+                sqlMap = builder.Configure(fileName);
+            }
+            catch(Exception ex)
+            {
+                Console.WriteLine(ex.StackTrace.ToString());
+            }
 
 			if ( sqlMap.DataSource.DbProvider.Name.IndexOf("PostgreSql")>=0)
 			{

Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Generics/ResiltMapTest.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Generics/ResiltMapTest.cs?rev=377813&view=auto
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Generics/ResiltMapTest.cs
(added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Generics/ResiltMapTest.cs
Tue Feb 14 12:07:27 2006
@@ -0,0 +1,59 @@
+using System;
+using System.Collections;
+using System.Configuration;
+using System.Collections.Generic;
+
+using NUnit.Framework;
+
+using IBatisNet.DataMapper.Test.Domain;
+
+namespace IBatisNet.DataMapper.Test.NUnit.SqlMapTests.Generics
+{
+    [TestFixture] 
+    public class ResultMapTest : BaseTest
+    {
+        #region SetUp & TearDown
+
+        /// <summary>
+        /// SetUp
+        /// </summary>
+        [SetUp]
+        public void Init()
+        {
+            InitScript(sqlMap.DataSource, ScriptDirectory + "account-init.sql");
+            InitScript(sqlMap.DataSource, ScriptDirectory + "account-procedure.sql", false);
+            InitScript(sqlMap.DataSource, ScriptDirectory + "order-init.sql");
+            InitScript(sqlMap.DataSource, ScriptDirectory + "line-item-init.sql");
+            InitScript(sqlMap.DataSource, ScriptDirectory + "enumeration-init.sql");
+        }
+
+        /// <summary>
+        /// TearDown
+        /// </summary>
+        [TearDown]
+        public void Dispose()
+        { /* ... */ }
+
+        #endregion
+
+        #region Result Map test
+
+        /// <summary>
+        /// Test generic Ilist  
+        /// order.LineItemsGenericList 
+        /// </summary>
+        [Test]
+        public void TestGenricListMapping()
+        {
+            Order order = sqlMap.QueryForObject<Order>("GetOrderWithGenricListLineItem",
1);
+
+            AssertOrder1(order);
+
+            // Check generic IList collection
+            Assert.IsNotNull(order.LineItemsGenericList);
+            Assert.AreEqual(2, order.LineItemsGenericList.Count);
+
+        }
+        #endregion
+    }
+}

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

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

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/ReadMe.txt
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/ReadMe.txt?rev=377813&r1=377812&r2=377813&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/ReadMe.txt (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/ReadMe.txt Tue Feb 14 12:07:27 2006
@@ -15,4 +15,7 @@
    create a file named DataBase.config with your own value for datasource.
    (WARNInG : don't included it in the solution and don't commit it in SVN)
    Put it in the bin/debug directory
+   
+4/ To test for .NET V2, enabled provider 'sqlServer2.0' and 
+   set <provider name="sqlServer2.0"/> in SqlMap_MSSQL_SqlClient.config
 	

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/ChangeLog.txt
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/ChangeLog.txt?rev=377813&r1=377812&r2=377813&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/ChangeLog.txt (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/ChangeLog.txt Tue Feb 14 12:07:27 2006
@@ -1,10 +1,26 @@
 IBatisNet Change Log
 
 ------------------------------
-1.3 - XX/XX/XXXX
+1.4 - XX/XX/XXX
+------------------------------
+- Added Support for .NET V2 and Generic
+	
+	public T QueryForObject<T>(string statementName, object parameterObject);
+	public T QueryForObject<T>(string statementName, object parameterObject, T instanceObject);
+	
+	public IList<T> QueryForList<T>(string statementName, object parameterObject);
+	public IList<T> QueryForList<T>(string statementName, object parameterObject,
int skipResults, int maxResults);
+	public void QueryForList<T>(string statementName, object parameterObject, IList<T>
resultObject);
+	
+	public IList<T> QueryWithRowDelegate<T>(string statementName, object parameterObject,
RowDelegate<T> rowDelegate);
+	
+	[also support object with generic list propertie Order{public IList<LineItem> LineItemsGenericList{...}};]
+
+------------------------------
+1.3 - 15/12/2005
 ------------------------------
 - - Added support for Implicit Result Maps as
-    <result property='author.firstName’ column=” Persons.FirstName”/>
+    <result property='author.firstName’ column=”Persons.FirstName”/>
 or
    SELECT    Persons.FirstName as 'author.firstName’
 - Added support to relation 1:0

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=377813&r1=377812&r2=377813&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs Tue Feb
14 12:07:27 2006
@@ -67,6 +67,7 @@
 		{
 			ExecuteQueryForObject =0,
 			ExecuteQueryForIList,
+            ExecuteQueryForGenericIList,
 			ExecuteQueryForArrayList,
 			ExecuteQueryForStrongTypedIList
 		}
@@ -1114,7 +1115,7 @@
 					postSelect.Statement.ExecuteQueryForList(session, postSelect.Keys, (IList)values);
 					ObjectProbe.SetPropertyValue( postSelect.Target, postSelect.ResultProperty.PropertyName,
values);
 				}
-				if (postSelect.Method == ExecuteMethod.ExecuteQueryForArrayList)
+				else if (postSelect.Method == ExecuteMethod.ExecuteQueryForArrayList)
 				{
 					IList values = postSelect.Statement.ExecuteQueryForList(session, postSelect.Keys); 
 					Type elementType = postSelect.ResultProperty.PropertyInfo.PropertyType.GetElementType();
@@ -1127,11 +1128,47 @@
 
 					postSelect.ResultProperty.PropertyInfo.SetValue(postSelect.Target, array, null);
 				}
-				else if (postSelect.Method == ExecuteMethod.ExecuteQueryForObject)
-				{
-					object value = postSelect.Statement.ExecuteQueryForObject(session, postSelect.Keys);

-					ObjectProbe.SetPropertyValue( postSelect.Target, postSelect.ResultProperty.PropertyName,
value);
-				}
+                else if (postSelect.Method == ExecuteMethod.ExecuteQueryForGenericIList)
+                {
+                    // How to: Examine and Instantiate Generic Types with Reflection  
+                    // http://msdn2.microsoft.com/en-us/library/b8ytshk6.aspx
+
+                    Type[] typeArgs = postSelect.ResultProperty.PropertyInfo.PropertyType.GetGenericArguments();
+                    Type definition = typeof(IList<>);
+                    Type constructedType = definition.MakeGenericType(typeArgs);
+                    Type elementType = postSelect.ResultProperty.PropertyInfo.PropertyType.GetGenericArguments()[0];
+
+                    Type mappedStatementType = postSelect.Statement.GetType();
+
+                    Type[] typeArguments = {typeof(IDalSession), typeof(object)};
+
+                    MethodInfo[] mis = mappedStatementType.GetMethods(BindingFlags.InvokeMethod
| BindingFlags.Public | BindingFlags.Instance);
+                    MethodInfo mi = null;
+                    foreach(MethodInfo m in mis)
+                    {
+                        if (m.IsGenericMethod && 
+                            m.Name == "ExecuteQueryForList" && 
+                            m.GetParameters().Length==2)
+                        {
+                            mi = m;
+                            break;
+                        }
+                    }
+
+                    MethodInfo miConstructed = mi.MakeGenericMethod(elementType);
+
+                    // Invoke the method.
+                    object[] args = {session, postSelect.Keys};
+                    object values = miConstructed.Invoke(postSelect.Statement, args);
+
+                    ObjectProbe.SetPropertyValue(postSelect.Target, postSelect.ResultProperty.PropertyName,
values);
+
+                }
+                else if (postSelect.Method == ExecuteMethod.ExecuteQueryForObject)
+                {
+                    object value = postSelect.Statement.ExecuteQueryForObject(session, postSelect.Keys);
+                    ObjectProbe.SetPropertyValue(postSelect.Target, postSelect.ResultProperty.PropertyName,
value);
+                }
 			}
 		}
 
@@ -1283,11 +1320,16 @@
 								postSelect.Method = ExecuteMethod.ExecuteQueryForStrongTypedIList;
 							}
 						}
-					} 
-					else // The ResultProperty is map to a .Net object
-					{
-						postSelect.Method = ExecuteMethod.ExecuteQueryForObject;
 					}
+                    else if ( mapping.PropertyInfo.PropertyType.IsGenericType &&

+                              mapping.PropertyInfo.PropertyType.GetGenericTypeDefinition()
== typeof(IList<>)) 
+                    {
+                        postSelect.Method = ExecuteMethod.ExecuteQueryForGenericIList;
+                    }
+                    else // The ResultProperty is map to a .Net object
+                    {
+                        postSelect.Method = ExecuteMethod.ExecuteQueryForObject;
+                    }
 					#endregion
 
 					if (!mapping.IsLazyLoad)

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs?rev=377813&r1=377812&r2=377813&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs Tue Feb 14 12:07:27 2006
@@ -678,7 +678,7 @@
         #endregion
 
         #region QueryForObject .NET 2.0
-        #if dotnet2
+#if dotnet2
         /// <summary>
         /// Executes a Sql SELECT statement that returns that returns data 
         /// to populate a single object instance.
@@ -762,7 +762,7 @@
 
             return result;
         }
-        #endif      
+#endif      
         #endregion
 
         #region QueryForMap, QueryForDictionary
@@ -993,7 +993,7 @@
 		#endregion
         
         #region QueryForList .NET 2.0
-        #if dotnet2
+#if dotnet2
         /// <summary>
         /// Executes a Sql SELECT statement that returns data to populate
         /// a number of result objects.
@@ -1126,7 +1126,7 @@
                 }
             }
         }
-        #endif
+#endif
         #endregion
 
 		#region QueryForPaginatedList



Mime
View raw message