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=473053&r1=473052&r2=473053
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectStrategy.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectStrategy.cs
 Thu Nov  9 12:02:26 2006
@@ -31,7 +31,6 @@
 using System.Data;
 using IBatisNet.DataMapper.Configuration.ResultMapping;
 using IBatisNet.DataMapper.Exceptions;
-using IBatisNet.DataMapper.Proxy;
 using IBatisNet.DataMapper.Scope;
 
 namespace IBatisNet.DataMapper.MappedStatements.PropertyStrategy
@@ -153,7 +152,8 @@
         /// <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)
+               /// <param name="target">The target object</param>
+               public object Get(RequestScope request, IResultMap resultMap, 
ResultProperty mapping, ref object target, IDataReader reader)
         {
             throw new NotSupportedException("Get method on ResultMapStrategy 
is not supported");
         }          

Modified: 
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=diff&rev=473053&r1=473052&r2=473053
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/GroupByStrategy.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/GroupByStrategy.cs
 Thu Nov  9 12:02:26 2006
@@ -23,15 +23,11 @@
  
********************************************************************************/
 #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;
 
@@ -41,46 +37,9 @@
     /// <see cref="IResultStrategy"/> implementation when 
     /// a 'groupBy' attribute is specified on the resultMap tag.
     /// </summary>
+    /// <remarks>N+1 Select solution</remarks>
     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
 
@@ -105,28 +64,16 @@
             {
                 // Unique key is already known, so get the existing result 
object and process additional results.
                 outObject = buildObjects[uniqueKey];
-                // process additional property with resulMapping attribute
+                // process resulMapping attribute wich point to a groupBy 
attribute
                 for (int index = 0; index < resultMap.Properties.Count; 
index++)
                 {
                     ResultProperty resultProperty = 
resultMap.Properties[index];
-                    if (resultProperty.PropertyStrategy is 
PropertyStrategy.ResultMapStrategy)
+                    if (resultProperty.PropertyStrategy is 
PropertStrategy.GroupByStrategy)
                     {
-                        // 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);
-                        }
+                        resultProperty.PropertyStrategy.Set(request, 
resultMap, resultProperty, ref outObject, reader, null);
                     }
                 }
-                outObject = RequestScope.SKIP;
+                outObject = SKIP;
             }
             else if (uniqueKey == null || buildObjects == null || 
!buildObjects.Contains(uniqueKey))
             {
@@ -142,44 +89,13 @@
                     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);
+                        resultProperty.PropertyStrategy.Set(request, 
resultMap, resultProperty, ref outObject, reader, null);
                     }
                     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);
+                            resultProperty.PropertyStrategy.Set(request, 
resultMap, resultProperty, ref outObject, reader, null);
                         }
                         else
                         {

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Proxy/LazyListGeneric.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Proxy/LazyListGeneric.cs?view=diff&rev=473053&r1=473052&r2=473053
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Proxy/LazyListGeneric.cs 
(original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Proxy/LazyListGeneric.cs Thu 
Nov  9 12:02:26 2006
@@ -56,7 +56,7 @@
         #endregion
 
         /// <summary>
-        /// Initializes a new instance of the <see cref="LazyListGeneric<T>"/> 
class.
+        /// Initializes a new instance of the LazyListGeneric class.
         /// </summary>
         /// <param name="mappedSatement">The mapped satement.</param>
         /// <param name="param">The param.</param>
@@ -146,7 +146,7 @@
         }
 
         /// <summary>
-        /// Gets or sets the <see cref="T"/> at the specified index.
+        /// Gets or sets the object at the specified index.
         /// </summary>
         /// <value></value>
         public T this[int index]
@@ -261,7 +261,7 @@
         /// Returns an enumerator that iterates through the collection.
         /// </summary>
         /// <returns>
-        /// A <see cref="System.Collections.Generic.IEnumerator`1"></see> that 
can be used to iterate through the collection.
+        /// A <see cref="System.Collections.Generic.IEnumerator"></see> that 
can be used to iterate through the collection.
         /// </returns>
         public IEnumerator<T> GetEnumerator()
         {
@@ -433,10 +433,10 @@
         }
 
         /// <summary>
-        /// Gets the number of elements contained in the <see 
cref="System.Collections.Generic.ICollection`1"></see>.
+        /// Gets the number of elements contained in the <see 
cref="System.Collections.Generic.ICollection"></see>.
         /// </summary>
         /// <value></value>
-        /// <returns>The number of elements contained in the <see 
cref="System.Collections.Generic.ICollection`1"></see>.</returns>
+        /// <returns>The number of elements contained in the <see 
cref="System.Collections.Generic.ICollection"></see>.</returns>
         int ICollection.Count
         {
             get { return this.Count; }

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?view=diff&rev=473053&r1=473052&r2=473053
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/RequestScope.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/RequestScope.cs Thu Nov  
9 12:02:26 2006
@@ -45,9 +45,6 @@
     /// </summary>
     public class RequestScope : IScope
     {
-        // Used by N+1 Select solution
-        public static object SKIP = new object();
-
         #region Fields
 
         private IStatement _statement = null;

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs?view=diff&rev=473053&r1=473052&r2=473053
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs Thu Nov  9 
12:02:26 2006
@@ -969,7 +969,7 @@
         /// <param name="parameterObject">The object used to set the 
parameters in the SQL.</param>
         /// <param name="keyProperty">The property of the result object to be 
used as the key.</param>
         /// <param name="valueProperty">The property of the result object to 
be used as the value (or null)</param>
-        /// <param name="rowDelegate"A delegate called once per row in the 
QueryForDictionary method></param>
+        /// <param name="rowDelegate">A delegate called once per row in the 
QueryForDictionary method></param>
         /// <returns>A IDictionary (Hashtable) of object containing the rows 
keyed by keyProperty.</returns>
         ///<exception cref="DataMapperException">If a transaction is not in 
progress, or the database throws an exception.</exception>
         public IDictionary<K, V> QueryForDictionary<K, V>(string 
statementName, object parameterObject, string keyProperty, string 
valueProperty, DictionaryRowDelegate<K, V> rowDelegate)


Reply via email to