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/07/23 17:47:11 UTC
svn commit: r424758 - in /ibatis/trunk/cs/mapper:
IBatisNet.DataMapper.Test/Domain/
IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/
IBatisNet.DataMapper.Test/NUnit/SqlMapTests/
IBatisNet.DataMapper.Test/Scripts/MSSQL/
IBatisNet.DataMapper/MappedStateme...
Author: gbayon
Date: Sun Jul 23 08:47:10 2006
New Revision: 424758
URL: http://svn.apache.org/viewvc?rev=424758&view=rev
Log:
- Fixed IBATISNET-175
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Account.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/InheritanceTest.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/documents-init.sql
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/DefaultStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/IArgumentStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/ResultMapStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectArrayStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectGenericListStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectListStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectObjectStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/ResultMapStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/ResultMapStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/RequestScope.cs
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Account.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Account.cs?rev=424758&r1=424757&r2=424758&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Account.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Account.cs Sun Jul 23 08:47:10 2006
@@ -15,6 +15,7 @@
private int[] _ids = null;
private bool _bannerOption = false;
private bool _cartOption = false;
+ private Document _document = null;
public Account()
{}
@@ -67,5 +68,11 @@
get { return _cartOption; }
set { _cartOption = value; }
}
+
+ public Document Document
+ {
+ get { return _document; }
+ set { _document = value; }
+ }
}
}
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml?rev=424758&r1=424757&r2=424758&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml Sun Jul 23 08:47:10 2006
@@ -93,6 +93,16 @@
<result property="BannerOption" column="Account_Banner_Option" dbType="Varchar" type="bool"/>
<result property="CartOption" column="Account_Cart_Option" typeHandler="HundredsBool"/>
</resultMap>
+
+ <resultMap id="account-result-joined-document" class="Account" >
+ <result property="id" column="Account_ID"/>
+ <result property="FirstName" column="Account_FirstName"/>
+ <result property="LastName" column="Account_LastName"/>
+ <result property="EmailAddress" column="Account_Email" nullValue="no_email@provided.com"/>
+ <result property="BannerOption" column="Account_Banner_Option" dbType="Varchar" type="bool"/>
+ <result property="CartOption" column="Account_Cart_Option" typeHandler="HundredsBool"/>
+ <result property="Document" resultMapping="Document.document"/>
+ </resultMap>
<resultMap id="indexed-account-result" class="Account">
<result property="Id" columnIndex="0"/>
@@ -126,7 +136,15 @@
=============================================
-->
<statements>
-
+
+ <select id="JIRA175" parameterClass="Integer"
+ resultMap="account-result-joined-document">
+ select *
+ from Accounts a, Documents d
+ where a.Account_ID = d.Account_ID
+ And a.Account_ID = #value#
+ </select>
+
<select id="SelectAccountConstructor" parameterClass="Integer"
resultMap="account-result-constructor">
select *
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/InheritanceTest.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/InheritanceTest.cs?rev=424758&r1=424757&r2=424758&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/InheritanceTest.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/InheritanceTest.cs Sun Jul 23 08:47:10 2006
@@ -30,6 +30,7 @@
[SetUp]
public void Init()
{
+ InitScript(sqlMap.DataSource, ScriptDirectory + "account-init.sql");
InitScript( sqlMap.DataSource, ScriptDirectory + "documents-init.sql" );
}
@@ -129,6 +130,22 @@
news = (Newspaper) list[5];
AssertNewspaper(news, 4, "Le Canard enchaine", "Paris");
}
+
+ /// <summary>
+ /// Test Inheritance On Result Property
+ /// </summary>
+ [Test]
+ public void TestJIRA175()
+ {
+ Account account = sqlMap.QueryForObject("JIRA175", 5) as Account;
+ Assert.AreEqual(5, account.Id, "account.Id");
+ Assert.AreEqual("Gilles", account.FirstName, "account.FirstName");
+
+ Book book = account.Document as Book;
+ Assert.IsNotNull(book);
+ AssertBook(book, 1, "The World of Null-A", 55);
+ }
+
#endregion
void AssertDocument(Document document, int id, string title)
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/documents-init.sql
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/documents-init.sql?rev=424758&r1=424757&r2=424758&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/documents-init.sql (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Scripts/MSSQL/documents-init.sql Sun Jul 23 08:47:10 2006
@@ -15,7 +15,8 @@
[Document_Title] [varchar] (32) NULL ,
[Document_Type] [varchar] (32) NULL ,
[Document_PageNumber] [int] NULL ,
- [Document_City] [varchar] (32) NULL
+ [Document_City] [varchar] (32) NULL,
+ [Account_Id] int null
) ON [PRIMARY]
ALTER TABLE [dbo].[Documents] WITH NOCHECK ADD
@@ -26,9 +27,9 @@
-- Creating Test Data
-INSERT INTO [dbo].[Documents] VALUES (1, 'The World of Null-A', 'Book', 55, null);
-INSERT INTO [dbo].[Documents] VALUES (2, 'Le Progres de Lyon', 'Newspaper', null , 'Lyon');
-INSERT INTO [dbo].[Documents] VALUES (3, 'Lord of the Rings', 'Book', 3587, null);
-INSERT INTO [dbo].[Documents] VALUES (4, 'Le Canard enchaine', 'Tabloid', null , 'Paris');
-INSERT INTO [dbo].[Documents] VALUES (5, 'Le Monde', 'Broadsheet', null , 'Paris');
-INSERT INTO [dbo].[Documents] VALUES (6, 'Foundation', 'Monograph', 557, null);
+INSERT INTO [dbo].[Documents] VALUES (1, 'The World of Null-A', 'Book', 55, null, 5);
+INSERT INTO [dbo].[Documents] VALUES (2, 'Le Progres de Lyon', 'Newspaper', null , 'Lyon', NULL);
+INSERT INTO [dbo].[Documents] VALUES (3, 'Lord of the Rings', 'Book', 3587, null, NULL);
+INSERT INTO [dbo].[Documents] VALUES (4, 'Le Canard enchaine', 'Tabloid', null , 'Paris', NULL);
+INSERT INTO [dbo].[Documents] VALUES (5, 'Le Monde', 'Broadsheet', null , 'Paris', NULL);
+INSERT INTO [dbo].[Documents] VALUES (6, 'Foundation', 'Monograph', 557, null, NULL);
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/DefaultStrategy.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/DefaultStrategy.cs?rev=424758&r1=424757&r2=424758&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/DefaultStrategy.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/DefaultStrategy.cs Sun Jul 23 08:47:10 2006
@@ -43,13 +43,12 @@
/// Gets the value of an argument constructor.
/// </summary>
/// <param name="request">The current <see cref="RequestScope"/>.</param>
- /// <param name="resultMap">The result map.</param>
/// <param name="mapping">The <see cref="ResultProperty"/> with the argument infos.</param>
/// <param name="reader">The current <see cref="IDataReader"/>.</param>
/// <param name="keys">The keys</param>
/// <returns>The paremeter value.</returns>
- public object GetValue(RequestScope request, ResultMap resultMap,
- ResultProperty mapping, ref IDataReader reader, object keys)
+ public object GetValue(RequestScope request, ResultProperty mapping,
+ ref IDataReader reader, object keys)
{
if (mapping.TypeHandler == null ||
mapping.TypeHandler is UnknownTypeHandler) // Find the TypeHandler
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/IArgumentStrategy.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/IArgumentStrategy.cs?rev=424758&r1=424757&r2=424758&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/IArgumentStrategy.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/IArgumentStrategy.cs Sun Jul 23 08:47:10 2006
@@ -38,12 +38,10 @@
/// Gets the value of an argument constructor.
/// </summary>
/// <param name="request">The current <see cref="RequestScope"/>.</param>
- /// <param name="resultMap">The result map.</param>
/// <param name="mapping">The <see cref="ResultProperty"/> with the argument infos.</param>
/// <param name="reader">The current <see cref="IDataReader"/>.</param>
/// <param name="keys">The keys</param>
/// <returns>The paremeter value.</returns>
- object GetValue(RequestScope request, ResultMap resultMap,
- ResultProperty mapping, ref IDataReader reader, object keys);
+ object GetValue(RequestScope request, ResultProperty mapping, ref IDataReader reader, object keys);
}
}
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/ResultMapStrategy.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/ResultMapStrategy.cs?rev=424758&r1=424757&r2=424758&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/ResultMapStrategy.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/ResultMapStrategy.cs Sun Jul 23 08:47:10 2006
@@ -41,24 +41,25 @@
/// Gets the value of an argument constructor.
/// </summary>
/// <param name="request">The current <see cref="RequestScope"/>.</param>
- /// <param name="resultMap">The result map.</param>
/// <param name="mapping">The <see cref="ResultProperty"/> with the argument infos.</param>
/// <param name="reader">The current <see cref="IDataReader"/>.</param>
/// <param name="keys">The keys</param>
/// <returns>The paremeter value.</returns>
- public object GetValue(RequestScope request, ResultMap resultMap,
- ResultProperty mapping, ref IDataReader reader, object keys)
+ public object GetValue(RequestScope request, ResultProperty mapping,
+ ref IDataReader reader, object keys)
{
object[] parameters = null;
bool isParameterFound = false;
- if (mapping.NestedResultMap.Parameters.Count >0)
+ ResultMap resultMapping = mapping.NestedResultMap.ResolveSubMap(reader);
+
+ if (resultMapping.Parameters.Count > 0)
{
- parameters = new object[mapping.NestedResultMap.Parameters.Count];
+ parameters = new object[resultMapping.Parameters.Count];
// Fill parameters array
- for(int index=0; index< mapping.NestedResultMap.Parameters.Count; index++)
+ for (int index = 0; index < resultMapping.Parameters.Count; index++)
{
- ResultProperty property = mapping.NestedResultMap.Parameters[index];
+ ResultProperty property = resultMapping.Parameters[index];
parameters[index] = property.GetDataBaseValue( reader );
request.IsRowDataFound = request.IsRowDataFound || (parameters[index] != null);
isParameterFound = isParameterFound || (parameters[index] != null);
@@ -67,14 +68,14 @@
object obj = null;
// If I have a constructor tag and all argumments values are null, the obj is null
- if (mapping.NestedResultMap.Parameters.Count >0 && isParameterFound==false)
+ if (resultMapping.Parameters.Count > 0 && isParameterFound == false)
{
obj = null;
}
else
{
- obj = mapping.NestedResultMap.CreateInstanceOfResult(parameters);
- if (FillObjectWithReaderAndResultMap(request, reader, mapping.NestedResultMap, obj) == false)
+ obj = resultMapping.CreateInstanceOfResult(parameters);
+ if (FillObjectWithReaderAndResultMap(request, reader, resultMapping, obj) == false)
{
obj = null;
}
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectArrayStrategy.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectArrayStrategy.cs?rev=424758&r1=424757&r2=424758&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectArrayStrategy.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectArrayStrategy.cs Sun Jul 23 08:47:10 2006
@@ -44,13 +44,12 @@
/// Gets the value of an argument constructor.
/// </summary>
/// <param name="request">The current <see cref="RequestScope"/>.</param>
- /// <param name="resultMap">The result map.</param>
/// <param name="mapping">The <see cref="ResultProperty"/> with the argument infos.</param>
/// <param name="reader">The current <see cref="IDataReader"/>.</param>
/// <param name="keys">The keys</param>
/// <returns>The paremeter value.</returns>
- public object GetValue(RequestScope request, ResultMap resultMap,
- ResultProperty mapping, ref IDataReader reader, object keys)
+ public object GetValue(RequestScope request, ResultProperty mapping,
+ ref IDataReader reader, object keys)
{
// Get the select statement
IMappedStatement selectStatement = request.MappedStatement.SqlMap.GetMappedStatement(mapping.Select);
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectGenericListStrategy.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectGenericListStrategy.cs?rev=424758&r1=424757&r2=424758&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectGenericListStrategy.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectGenericListStrategy.cs Sun Jul 23 08:47:10 2006
@@ -50,13 +50,12 @@
/// Gets the value of an argument constructor.
/// </summary>
/// <param name="request">The current <see cref="RequestScope"/>.</param>
- /// <param name="resultMap">The result map.</param>
/// <param name="mapping">The <see cref="ResultProperty"/> with the argument infos.</param>
/// <param name="reader">The current <see cref="IDataReader"/>.</param>
/// <param name="keys">The keys</param>
/// <returns>The paremeter value.</returns>
- public object GetValue(RequestScope request, ResultMap resultMap,
- ResultProperty mapping, ref IDataReader reader, object keys)
+ public object GetValue(RequestScope request, ResultProperty mapping,
+ ref IDataReader reader, object keys)
{
// Get the select statement
IMappedStatement selectStatement = request.MappedStatement.SqlMap.GetMappedStatement(mapping.Select);
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectListStrategy.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectListStrategy.cs?rev=424758&r1=424757&r2=424758&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectListStrategy.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectListStrategy.cs Sun Jul 23 08:47:10 2006
@@ -45,13 +45,12 @@
/// Gets the value of an argument constructor.
/// </summary>
/// <param name="request">The current <see cref="RequestScope"/>.</param>
- /// <param name="resultMap">The result map.</param>
/// <param name="mapping">The <see cref="ResultProperty"/> with the argument infos.</param>
/// <param name="reader">The current <see cref="IDataReader"/>.</param>
/// <param name="keys">The keys</param>
/// <returns>The paremeter value.</returns>
- public object GetValue(RequestScope request, ResultMap resultMap,
- ResultProperty mapping, ref IDataReader reader, object keys)
+ public object GetValue(RequestScope request, ResultProperty mapping,
+ ref IDataReader reader, object keys)
{
// Get the select statement
IMappedStatement selectStatement = request.MappedStatement.SqlMap.GetMappedStatement(mapping.Select);
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectObjectStrategy.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectObjectStrategy.cs?rev=424758&r1=424757&r2=424758&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectObjectStrategy.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectObjectStrategy.cs Sun Jul 23 08:47:10 2006
@@ -45,13 +45,12 @@
/// Gets the value of an argument constructor.
/// </summary>
/// <param name="request">The current <see cref="RequestScope"/>.</param>
- /// <param name="resultMap">The result map.</param>
/// <param name="mapping">The <see cref="ResultProperty"/> with the argument infos.</param>
/// <param name="reader">The current <see cref="IDataReader"/>.</param>
/// <param name="keys">The keys</param>
/// <returns>The paremeter value.</returns>
- public object GetValue(RequestScope request, ResultMap resultMap,
- ResultProperty mapping, ref IDataReader reader, object keys)
+ public object GetValue(RequestScope request, ResultProperty mapping,
+ ref IDataReader reader, object keys)
{
// Get the select statement
IMappedStatement selectStatement = request.MappedStatement.SqlMap.GetMappedStatement(mapping.Select);
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectStrategy.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectStrategy.cs?rev=424758&r1=424757&r2=424758&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectStrategy.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectStrategy.cs Sun Jul 23 08:47:10 2006
@@ -91,13 +91,12 @@
/// Gets the value of an argument constructor.
/// </summary>
/// <param name="request">The current <see cref="RequestScope"/>.</param>
- /// <param name="resultMap">The result map.</param>
/// <param name="mapping">The <see cref="ResultProperty"/> with the argument infos.</param>
/// <param name="reader">The current <see cref="IDataReader"/>.</param>
/// <param name="selectKeys">The keys</param>
/// <returns>The paremeter value.</returns>
- public object GetValue(RequestScope request, ResultMap resultMap,
- ResultProperty mapping, ref IDataReader reader, object selectKeys)
+ public object GetValue(RequestScope request, ResultProperty mapping,
+ ref IDataReader reader, object selectKeys)
{
string paramString = mapping.ColumnName;
object keys = null;
@@ -141,7 +140,7 @@
else // Collection object or .Net object
{
// lazyLoading is not permit for argument constructor
- return _selectStrategy.GetValue(request, resultMap, mapping, ref reader, keys);
+ return _selectStrategy.GetValue(request, mapping, ref reader, keys);
}
}
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?rev=424758&r1=424757&r2=424758&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/ResultMapStrategy.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/ResultMapStrategy.cs Sun Jul 23 08:47:10 2006
@@ -55,14 +55,16 @@
object[] parameters = null;
bool isParameterFound = false;
- if (mapping.NestedResultMap.Parameters.Count >0)
+ ResultMap resultMapping = mapping.NestedResultMap.ResolveSubMap(reader);
+
+ if (resultMapping.Parameters.Count > 0)
{
- parameters = new object[mapping.NestedResultMap.Parameters.Count];
+ parameters = new object[resultMapping.Parameters.Count];
// Fill parameters array
- for(int index=0; index< mapping.NestedResultMap.Parameters.Count; index++)
+ for (int index = 0; index < resultMapping.Parameters.Count; index++)
{
- ResultProperty resultProperty = mapping.NestedResultMap.Parameters[index];
- parameters[index] = resultProperty.ArgumentStrategy.GetValue(request, mapping.NestedResultMap, resultProperty, ref reader, null);
+ 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);
}
@@ -70,16 +72,16 @@
object obj = null;
// If I have a constructor tag and all argumments values are null, the obj is null
- if (mapping.NestedResultMap.Parameters.Count >0 && isParameterFound==false)
+ if (resultMapping.Parameters.Count > 0 && isParameterFound == false)
{
obj = null;
}
else
{
- obj = mapping.NestedResultMap.CreateInstanceOfResult(parameters);
+ obj = resultMapping.CreateInstanceOfResult(parameters);
// Fills properties on the new object
- if (this.FillObjectWithReaderAndResultMap(request, reader, mapping.NestedResultMap, obj) == false)
+ if (this.FillObjectWithReaderAndResultMap(request, reader, resultMapping, obj) == false)
{
obj = null;
}
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/ResultMapStrategy.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/ResultMapStrategy.cs?rev=424758&r1=424757&r2=424758&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/ResultMapStrategy.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/ResultMapStrategy.cs Sun Jul 23 08:47:10 2006
@@ -46,9 +46,10 @@
/// <param name="resultObject">The result object.</param>
public object Process(RequestScope request, ref IDataReader reader, object resultObject)
{
- object outObject = resultObject;
+ object outObject = resultObject;
+
+ ResultMap resultMap = request.Statement.ResultMap.ResolveSubMap(reader);
- ResultMap resultMap = request.GetResultMap(reader);
if (outObject == null)
{
object[] parameters = null;
@@ -59,7 +60,7 @@
for (int index = 0; index < resultMap.Parameters.Count; index++)
{
ResultProperty resultProperty = resultMap.Parameters[index];
- parameters[index] = resultProperty.ArgumentStrategy.GetValue(request, resultMap, resultProperty, ref reader, null);
+ parameters[index] = resultProperty.ArgumentStrategy.GetValue(request, resultProperty, ref reader, null);
}
}
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/RequestScope.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/RequestScope.cs?rev=424758&r1=424757&r2=424758&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/RequestScope.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/RequestScope.cs Sun Jul 23 08:47:10 2006
@@ -30,14 +30,11 @@
using System.Data;
using System.Runtime.CompilerServices;
using IBatisNet.Common;
-using IBatisNet.Common.Utilities.Objects;
-using IBatisNet.Common.Utilities.Objects.Members;
using IBatisNet.DataMapper.Configuration.ParameterMapping;
using IBatisNet.DataMapper.Configuration.ResultMapping;
using IBatisNet.DataMapper.Configuration.Statements;
using IBatisNet.DataMapper.DataExchange;
using IBatisNet.DataMapper.MappedStatements;
-using IBatisNet.DataMapper.TypeHandlers;
#endregion
@@ -200,16 +197,6 @@
public override int GetHashCode()
{
return (int) (_id ^ (_id >> 32));
- }
-
- /// <summary>
- /// Check if the ResultMap is well set, process case of subMap resultMap.
- /// </summary>
- /// <param name="dataReader">The current IDataReader</param>
- /// <returns>the resultMap to use</returns>
- public ResultMap GetResultMap(IDataReader dataReader)
- {
- return _statement.ResultMap.ResolveSubMap(dataReader);
}
/// <summary>