Author: gbayon
Date: Wed Aug  3 22:14:37 2005
New Revision: 227305

URL: http://svn.apache.org/viewcvs?rev=227305&view=rev
Log:
- Completed support for relation 1-0 + added a complex unit test

Added:
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/A.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/B.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/C.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/D.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/E.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/F.cs
Modified:
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.csproj
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Other.xml
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/BaseTest.cs
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/other-init.sql
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs

Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/A.cs
URL: 
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/A.cs?rev=227305&view=auto
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/A.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/A.cs Wed Aug  3 
22:14:37 2005
@@ -0,0 +1,46 @@
+using System;
+
+namespace IBatisNet.DataMapper.Test.Domain
+{
+       /// <summary>
+       /// Summary description for A.
+       /// </summary>
+       public class A
+       {
+               private string _id;
+               private string _libelle;
+               private B _b;
+               private E _e;
+               private F _f;
+
+               public B B
+               {
+                       get { return _b; }
+                       set { _b = value; }
+               }
+
+               public E E
+               {
+                       get { return _e; }
+                       set { _e = value; }
+               }
+
+               public F F
+               {
+                       get { return _f; }
+                       set { _f = value; }
+               }
+
+               public string Id
+               {
+                       get { return _id; }
+                       set { _id = value; }
+               }
+
+               public string Libelle
+               {
+                       get { return _libelle; }
+                       set { _libelle = value; }
+               }
+       }
+}

Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/B.cs
URL: 
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/B.cs?rev=227305&view=auto
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/B.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/B.cs Wed Aug  3 
22:14:37 2005
@@ -0,0 +1,40 @@
+using System;
+
+namespace IBatisNet.DataMapper.Test.Domain
+{
+       /// <summary>
+       /// Summary description for B.
+       /// </summary>
+       public class B 
+       {
+               private C _c;
+               private string _id;
+               private string _libelle;
+
+               public string Id
+               {
+                       get { return _id; }
+                       set { _id = value; }
+               }
+
+               public string Libelle
+               {
+                       get { return _libelle; }
+                       set { _libelle = value; }
+               }
+
+               public C C
+               {
+                       get { return _c; }
+                       set { _c = value; }
+               }
+
+               private D _d;
+
+               public D D
+               {
+                       get { return _d; }
+                       set { _d = value; }
+               }
+       }
+}

Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/C.cs
URL: 
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/C.cs?rev=227305&view=auto
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/C.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/C.cs Wed Aug  3 
22:14:37 2005
@@ -0,0 +1,25 @@
+using System;
+
+namespace IBatisNet.DataMapper.Test.Domain
+{
+       /// <summary>
+       /// Summary description for C.
+       /// </summary>
+       public class C 
+       {
+               private string _id;
+               private string _libelle;
+
+               public string Id
+               {
+                       get { return _id; }
+                       set { _id = value; }
+               }
+
+               public string Libelle
+               {
+                       get { return _libelle; }
+                       set { _libelle = value; }
+               }
+       }
+}

Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/D.cs
URL: 
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/D.cs?rev=227305&view=auto
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/D.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/D.cs Wed Aug  3 
22:14:37 2005
@@ -0,0 +1,25 @@
+using System;
+
+namespace IBatisNet.DataMapper.Test.Domain
+{
+       /// <summary>
+       /// Summary description for D.
+       /// </summary>
+       public class D 
+       {
+               private string _id;
+               private string _libelle;
+
+               public string Id
+               {
+                       get { return _id; }
+                       set { _id = value; }
+               }
+
+               public string Libelle
+               {
+                       get { return _libelle; }
+                       set { _libelle = value; }
+               }
+       }
+}

Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/E.cs
URL: 
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/E.cs?rev=227305&view=auto
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/E.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/E.cs Wed Aug  3 
22:14:37 2005
@@ -0,0 +1,25 @@
+using System;
+
+namespace IBatisNet.DataMapper.Test.Domain
+{
+       /// <summary>
+       /// Summary description for E.
+       /// </summary>
+       public class E
+       {
+               private string _id;
+               private string _libelle;
+
+               public string Id
+               {
+                       get { return _id; }
+                       set { _id = value; }
+               }
+
+               public string Libelle
+               {
+                       get { return _libelle; }
+                       set { _libelle = value; }
+               }
+       }
+}

Added: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/F.cs
URL: 
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/F.cs?rev=227305&view=auto
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/F.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/F.cs Wed Aug  3 
22:14:37 2005
@@ -0,0 +1,25 @@
+using System;
+
+namespace IBatisNet.DataMapper.Test.Domain
+{
+       /// <summary>
+       /// Summary description for F.
+       /// </summary>
+       public class F
+       {
+               private string _id;
+               private string _libelle;
+
+               public string Id
+               {
+                       get { return _id; }
+                       set { _id = value; }
+               }
+
+               public string Libelle
+               {
+                       get { return _libelle; }
+                       set { _libelle = value; }
+               }
+       }
+}

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.csproj
URL: 
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.csproj?rev=227305&r1=227304&r2=227305&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.csproj
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/IBatisNet.DataMapper.Test.csproj
 Wed Aug  3 22:14:37 2005
@@ -182,6 +182,11 @@
                     BuildAction = "None"
                 />
                 <File
+                    RelPath = "Domain\A.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "Domain\Account.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
@@ -197,11 +202,21 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = "Domain\B.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "Domain\Book.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = "Domain\C.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "Domain\Category.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
@@ -217,6 +232,11 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = "Domain\D.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "Domain\Document.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
@@ -227,7 +247,17 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = "Domain\E.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "Domain\Enumeration.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Domain\F.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Other.xml
URL: 
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Other.xml?rev=227305&r1=227304&r2=227305&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Other.xml 
(original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Other.xml 
Wed Aug  3 22:14:37 2005
@@ -5,6 +5,13 @@
        
        <alias>
                <typeAlias alias="Other" 
type="IBatisNet.DataMapper.Test.Domain.Other, IBatisNet.DataMapper.Test"/>
+               <typeAlias alias="A" type="IBatisNet.DataMapper.Test.Domain.A, 
IBatisNet.DataMapper.Test"/>
+               <typeAlias alias="B" type="IBatisNet.DataMapper.Test.Domain.B, 
IBatisNet.DataMapper.Test"/>
+               <typeAlias alias="C" type="IBatisNet.DataMapper.Test.Domain.C, 
IBatisNet.DataMapper.Test"/>
+               <typeAlias alias="D" type="IBatisNet.DataMapper.Test.Domain.D, 
IBatisNet.DataMapper.Test"/>
+               <typeAlias alias="E" type="IBatisNet.DataMapper.Test.Domain.E, 
IBatisNet.DataMapper.Test"/>
+               <typeAlias alias="F" type="IBatisNet.DataMapper.Test.Domain.F, 
IBatisNet.DataMapper.Test"/>
+
        </alias>        
        
        <resultMaps>                                    
@@ -14,10 +21,66 @@
                        <result property="Bool"         column="Other_Bit"/>
                        <result property="Bool2"        column="Other_String" 
typeHandler="OuiNonBool"/>
                </resultMap>
+               
+               <resultMap id="A-result"  class="A" >
+                       <result property="Id"           column="A_ID"/>
+                       <result property="Libelle"      column="A_Libelle"/>
+                       <result property="B"            
resultMapping="Other.B-result"/>
+                       <result property="E"            
resultMapping="Other.E-result"/>
+                       <result property="F"            
resultMapping="Other.F-result"/>
+               </resultMap>
+                       
+               <resultMap id="B-result"  class="B" >
+                       <result property="Id"           column="B_ID"/>
+                       <result property="Libelle"      column="B_Libelle"/>
+                       <result property="C"            
resultMapping="Other.C-result"/>
+                       <result property="D"            
resultMapping="Other.D-result"/>
+               </resultMap>
+                               
+               <resultMap id="C-result"  class="C" >
+                       <result property="Id"           column="C_ID"/>
+                       <result property="Libelle"      column="C_Libelle"/>
+               </resultMap>
+               
+               <resultMap id="D-result"  class="D" >
+                       <result property="Id"           column="D_ID"/>
+                       <result property="Libelle"      column="D_Libelle"/>
+               </resultMap>
+
+               <resultMap id="E-result"  class="E" >
+                       <result property="Id"           column="E_ID"/>
+                       <result property="Libelle"      column="E_Libelle"/>
+               </resultMap>    
+
+               <resultMap id="F-result"  class="F" >
+                       <result property="Id"           column="F_ID"/>
+                       <result property="Libelle"      column="F_Libelle"/>
+               </resultMap>                    
        </resultMaps>
        
        <statements>
        
+               <select id="SelectComplexJoined" resultMap="A-result">
+               SELECT     
+                       A.Id AS A_ID,
+                       A.A_Libelle AS A_Libelle, 
+                       B.ID AS B_ID,
+                       B.B_Libelle AS B_Libelle,
+                       C.ID AS C_ID,
+                       C.C_Libelle AS C_Libelle,
+                       D.ID AS D_ID,
+                       D.D_Libelle AS D_Libelle,
+                       E.ID AS E_ID,
+                       E.E_Libelle AS E_Libelle,
+                       F.ID AS F_ID,
+                       F.F_Libelle AS F_Libelle 
+                       FROM         A 
+                       LEFT OUTER JOIN B ON A.B_ID = B.ID 
+                       LEFT OUTER JOIN C ON B.C_ID = C.ID
+                       LEFT OUTER JOIN D ON B.D_ID = D.ID
+                       LEFT OUTER JOIN E ON A.E_ID = E.ID
+                       LEFT OUTER JOIN F ON A.F_ID = F.ID
+               </select>
                <statement id="DynamicSelectByIntLong" 
                        parameterClass="Hashtable" 
                        resultMap="other-result">

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=227305&r1=227304&r2=227305&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 
Wed Aug  3 22:14:37 2005
@@ -52,7 +52,6 @@
                {
                        //DateTime start = DateTime.Now;
 
-//                     ConfigureHandler handler = new 
ConfigureHandler(Configure);
                        DomSqlMapBuilder builder = new DomSqlMapBuilder();
                        string fileName = "sqlmap" + "_" + 
ConfigurationSettings.AppSettings["database"] + "_" + 
ConfigurationSettings.AppSettings["providerType"] + ".config";
                        sqlMap = builder.Configure(fileName);

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs
URL: 
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs?rev=227305&r1=227304&r2=227305&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/StatementTest.cs
 Wed Aug  3 22:14:37 2005
@@ -648,11 +648,7 @@
                }
 
                /// <summary>
-               /// Test ExecuteQueryForMap : Hashtable.
-               /// </summary>
-               /// <remarks>
-               /// If the keyProperty is an integer, you must acces the map
-               /// by map[integer] and not by map["integer"]
+               /// Test ExecuteQueryForWithJoined
                /// </remarks>
                [Test]
                public void TestExecuteQueryForWithJoined()
@@ -664,6 +660,22 @@
                        order = 
sqlMap.QueryForObject("GetOrderJoinWithAccount",11) as Order;
 
                        Assert.IsNull(order.Account);
+               }
+
+               /// <summary>
+               /// Test ExecuteQueryFor With Complex Joined
+               /// </remarks>
+               [Test]
+               public void TestExecuteQueryForWithComplexJoined()
+               {
+                       A a = sqlMap.QueryForObject("SelectComplexJoined",null) 
as A;
+
+                       Assert.IsNotNull(a);
+                       Assert.IsNotNull(a.B);
+                       Assert.IsNotNull(a.B.C);
+                       Assert.IsNull(a.B.D);
+                       Assert.IsNotNull(a.E);
+                       Assert.IsNull(a.F);
                }
                #endregion
 

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/other-init.sql
URL: 
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/other-init.sql?rev=227305&r1=227304&r2=227305&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/other-init.sql 
(original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/other-init.sql 
Wed Aug  3 22:14:37 2005
@@ -7,6 +7,32 @@
        drop table [dbo].[Others]
 END
 
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[A]') and 
OBJECTPROPERTY(id, N'IsUserTable') = 1)
+BEGIN
+       drop table [dbo].[A]
+END
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[B]') and 
OBJECTPROPERTY(id, N'IsUserTable') = 1)
+BEGIN
+       drop table [dbo].[B]
+END
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[C]') and 
OBJECTPROPERTY(id, N'IsUserTable') = 1)
+BEGIN
+       drop table [dbo].[C]
+END
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[D]') and 
OBJECTPROPERTY(id, N'IsUserTable') = 1)
+BEGIN
+       drop table [dbo].[D]
+END
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[E]') and 
OBJECTPROPERTY(id, N'IsUserTable') = 1)
+BEGIN
+       drop table [dbo].[E]
+END
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[F]') and 
OBJECTPROPERTY(id, N'IsUserTable') = 1)
+BEGIN
+       drop table [dbo].[F]
+END
+
+
 CREATE TABLE [dbo].[Others] (
        [Other_Int] [int]  NULL ,
        [Other_Long] [BigInt] NULL,
@@ -14,7 +40,106 @@
        [Other_String] [varchar] (32) NOT NULL
 ) ON [PRIMARY]
 
+CREATE TABLE [dbo].[F] (
+       [ID] [varchar] (50) NOT NULL ,
+       [F_Libelle] [varchar] (50) NULL ,
+       CONSTRAINT [PK_F] PRIMARY KEY  CLUSTERED 
+       (
+               [ID]
+       )  ON [PRIMARY] 
+) ON [PRIMARY]
+
+CREATE TABLE [dbo].[E] (
+       [ID] [varchar] (50) NOT NULL ,
+       [E_Libelle] [varchar] (50) NULL ,
+       CONSTRAINT [PK_E] PRIMARY KEY  CLUSTERED 
+       (
+               [ID]
+       )  ON [PRIMARY] 
+) ON [PRIMARY]
+
+CREATE TABLE [dbo].[D] (
+       [ID] [varchar] (50) NOT NULL ,
+       [D_Libelle] [varchar] (50) NULL ,
+       CONSTRAINT [PK_D] PRIMARY KEY  CLUSTERED 
+       (
+               [ID]
+       )  ON [PRIMARY] 
+) ON [PRIMARY]
+
+CREATE TABLE [dbo].[C] (
+       [ID] [varchar] (50) NOT NULL ,
+       [C_Libelle] [varchar] (50) NULL ,
+       CONSTRAINT [PK_C] PRIMARY KEY  CLUSTERED 
+       (
+               [ID]
+       )  ON [PRIMARY] 
+) ON [PRIMARY]
+
+
+CREATE TABLE [dbo].[B] (
+       [ID] [varchar] (50) NOT NULL ,
+       [C_ID] [varchar] (50) NULL ,
+       [D_ID] [varchar] (50) NULL ,
+       [B_Libelle] [varchar] (50) NULL ,
+       CONSTRAINT [PK_B] PRIMARY KEY  CLUSTERED 
+       (
+               [ID]
+       )  ON [PRIMARY] ,
+       CONSTRAINT [FK_B_C] FOREIGN KEY 
+       (
+               [C_ID]
+       ) REFERENCES [C] (
+               [ID]
+       ),
+       CONSTRAINT [FK_B_D] FOREIGN KEY 
+       (
+               [D_ID]
+       ) REFERENCES [D] (
+               [ID]
+       )
+) ON [PRIMARY]
+
+
+CREATE TABLE [dbo].[A] (
+       [Id] [varchar] (50)  NOT NULL ,
+       [B_ID] [varchar] (50)  NULL ,
+       [E_ID] [varchar] (50)  NULL ,
+       [F_ID] [varchar] (50)  NULL ,
+       [A_Libelle] [varchar] (50)  NULL
+       CONSTRAINT [PK_A] PRIMARY KEY  CLUSTERED 
+       (
+               [Id]
+       )  ON [PRIMARY] ,
+       CONSTRAINT [FK_A_B] FOREIGN KEY 
+       (
+               [B_ID]
+       ) REFERENCES [B] (
+               [ID]
+       ),
+       CONSTRAINT [FK_A_E] FOREIGN KEY 
+       (
+               [E_ID]
+       ) REFERENCES [E] (
+               [ID]
+       ),
+       CONSTRAINT [FK_A_F] FOREIGN KEY 
+       (
+               [F_ID]
+       ) REFERENCES [F] (
+               [ID]
+       )
+) ON [PRIMARY]
+
+
 -- Creating Test Data
 
 INSERT INTO [dbo].[Others] VALUES(1, 8888888, 0, 'Oui');
-INSERT INTO [dbo].[Others] VALUES(2, 9999999999, 1, 'Non');
\ No newline at end of file
+INSERT INTO [dbo].[Others] VALUES(2, 9999999999, 1, 'Non');
+
+INSERT INTO [dbo].[F] VALUES('f', 'fff');
+INSERT INTO [dbo].[E] VALUES('e', 'eee');
+INSERT INTO [dbo].[D] VALUES('d', 'ddd');
+INSERT INTO [dbo].[C] VALUES('c', 'ccc');
+INSERT INTO [dbo].[B] VALUES('b', 'c', null, 'bbb');
+INSERT INTO [dbo].[A] VALUES('a', 'b', 'e', null, 'aaa');
\ No newline at end of file

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=227305&r1=227304&r2=227305&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs 
(original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs 
Wed Aug  3 22:14:37 2005
@@ -230,17 +230,23 @@
                /// <param name="reader"></param>
                /// <param name="resultMap"></param>
                /// <param name="resultObject"></param>
-               private void FillObjectWithReaderAndResultMap(RequestScope 
request,IDataReader reader, 
+               private bool FillObjectWithReaderAndResultMap(RequestScope 
request,IDataReader reader, 
                        ResultMap resultMap, object resultObject)
                {
-                       request.IsRowDataFound = false;
-
+                       bool rowDataFound = request.IsRowDataFound;
+                       bool dataFound = false;
+                       
                        // For each Property in the ResultMap, set the property 
in the object 
                        foreach(DictionaryEntry entry in 
resultMap.ColumnsToPropertiesMap)
                        {
+                               request.IsRowDataFound = false;
                                ResultProperty property = 
(ResultProperty)entry.Value;
                                SetObjectProperty(request, resultMap, property, 
ref resultObject, reader);
+                               dataFound = dataFound || request.IsRowDataFound;
                        }
+
+                       request.IsRowDataFound = rowDataFound;
+                       return dataFound;
                }
 
                /// <summary>
@@ -906,11 +912,11 @@
                                object obj = null;
 
                                obj = 
mapping.NestedResultMap.CreateInstanceOfResult();
-                               FillObjectWithReaderAndResultMap(request, 
reader, mapping.NestedResultMap, obj);
-                               if (request.IsRowDataFound == false)
+                               if (FillObjectWithReaderAndResultMap(request, 
reader, mapping.NestedResultMap, obj) == false)
                                {
                                        obj = null;
                                }
+
                                MappedStatement.SetValueOfProperty( ref target, 
mapping, obj );
                        }
                        else //'select' ResultProperty 


Reply via email to