Author: gbayon
Date: Sat May 17 05:43:55 2008
New Revision: 657348

URL: http://svn.apache.org/viewvc?rev=657348&view=rev
Log:
Improve code

Modified:
    
ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/App.config
    
ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/GroupByStrategy.cs
    
ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper/MappedStatements/ResultStrategy/GroupByStrategy.cs
    
ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper/Model/ResultMapping/ResultMap.cs
    ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper/Scope/RequestScope.cs

Modified: 
ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/App.config
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/App.config?rev=657348&r1=657347&r2=657348&view=diff
==============================================================================
--- 
ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/App.config 
(original)
+++ 
ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper.SqlClient.Test.2005/App.config 
Sat May 17 05:43:55 2008
@@ -10,41 +10,25 @@
   <appSettings>
     <!-- To enable internal log4net logging specify the following appSettings 
key -->
     <!-- <add key="log4net.Internal.Debug" value="true"/> -->
-
-    <!-- To test MySql set value="MySql" -->
-    <!-- To test Oracle set value="Oracle" -->
-    <!-- To test Access set value="Access" -->
-    <!-- To test MS Sql Server set value="MSSQL"  -->
-    <!-- To test PostgreSQL set value="PostgreSQL"  -->
-    <add key="database" value="MSSQL"/>
-    <!-- To test MS SqlServer via SqlClient value="SqlClient"  -->
-    <!-- To test Oracle via MS Oracle provider value="OracleClient"  -->
-    <!-- To test Oracle via Oracle provider value="ODP"  -->
-    <!-- To test PostgreSQL via Npgsql provider value="Npgsql"  -->
-    <!-- To test MySql via ByteFx value="ByteFx"  -->
-    <!-- To test MySql via MySql provider value="MySql"  -->
-    <!-- To test via OleDb provider (any database) value="OleDb"  -->
-    <!-- To test via Odbc provider (any database) value="Odbc"  -->
-    <add key="providerType" value="SqlClient"/>
   </appSettings>
 
   <iBATIS>
     <logging>
-      
+<!--      
        <logFactoryAdapter 
type="Apache.Ibatis.Common.Logging.Impl.ConsoleOutLoggerFA, 
Apache.Ibatis.Common">
                                <arg key="showLogName" value="true" />
                                <arg key="showDataTime" value="true" />
                                <arg key="level" value="ALL" />
                                <arg key="dateTimeFormat" value="yyyy/MM/dd 
HH:mm:ss:SSS" />
-                       </logFactoryAdapter>    
+                       </logFactoryAdapter>    -->
       <!--      <logFactoryAdapter 
type="Apache.Ibatis.Common.Logging.Impl.Log4NetLoggerFA, 
Apache.Ibatis.Common.Logging.Log4Net">
         <arg key="configType" value="inline" />
       </logFactoryAdapter> 
 -->
 
-<!--
+
       <logFactoryAdapter type="Apache.Ibatis.Common.Logging.Impl.NoOpLoggerFA, 
Apache.Ibatis.Common" />
--->
+
 
     </logging>
   </iBATIS>

Modified: 
ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/GroupByStrategy.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/GroupByStrategy.cs?rev=657348&r1=657347&r2=657348&view=diff
==============================================================================
--- 
ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/GroupByStrategy.cs
 (original)
+++ 
ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper/MappedStatements/PropertStrategy/GroupByStrategy.cs
 Sat May 17 05:43:55 2008
@@ -101,9 +101,9 @@
                  string uniqueKey = GetUniqueKey(propertyRresultMap, request, 
reader);
 
                 // Gets the [key, result object] already build
-                IDictionary buildObjects = 
request.GetUniqueKeys(propertyRresultMap);
+                IDictionary<string, object> buildObjects = 
request.GetUniqueKeys(propertyRresultMap);
 
-                if (buildObjects != null && buildObjects.Contains(uniqueKey))
+                if (buildObjects != null && 
buildObjects.ContainsKey(uniqueKey))
                 {
                     // Unique key is already known, so get the existing result 
object and process additional results.
                     result = buildObjects[uniqueKey];
@@ -124,14 +124,14 @@
                     }
                     result = SKIP;
                 }
-                else if (uniqueKey == null || buildObjects == null || 
!buildObjects.Contains(uniqueKey))
+                else if (uniqueKey == null || buildObjects == null || 
!buildObjects.ContainsKey(uniqueKey))
                 {
                     // Unique key is NOT known, so create a new result object 
and then process additional results.
                     result = _resultMapStrategy.Get(request, resultMap, 
mapping, ref target, reader);
 
                     if (buildObjects == null)
                     {
-                        buildObjects = new Hashtable();
+                        buildObjects = new Dictionary<string, object>();
                         request.SetUniqueKeys(propertyRresultMap, 
buildObjects);
                     }
                     buildObjects[uniqueKey] = result;                       

Modified: 
ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper/MappedStatements/ResultStrategy/GroupByStrategy.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper/MappedStatements/ResultStrategy/GroupByStrategy.cs?rev=657348&r1=657347&r2=657348&view=diff
==============================================================================
--- 
ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper/MappedStatements/ResultStrategy/GroupByStrategy.cs
 (original)
+++ 
ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper/MappedStatements/ResultStrategy/GroupByStrategy.cs
 Sat May 17 05:43:55 2008
@@ -56,9 +56,9 @@
 
             string uniqueKey = GetUniqueKey(resultMap, request, reader);
             // Gets the [key, result object] already build
-            IDictionary buildObjects = request.GetUniqueKeys(resultMap);
+            IDictionary<string, object> buildObjects = 
request.GetUniqueKeys(resultMap);
 
-            if (buildObjects != null && buildObjects.Contains(uniqueKey))
+            if (buildObjects != null && buildObjects.ContainsKey(uniqueKey))
             {
                 // Unique key is already known, so get the existing result 
object and process additional results.
                 outObject = buildObjects[uniqueKey];
@@ -73,7 +73,7 @@
                 }
                 outObject = SKIP;
             }
-            else if (uniqueKey == null || buildObjects == null || 
!buildObjects.Contains(uniqueKey))
+            else if (uniqueKey == null || buildObjects == null || 
!buildObjects.ContainsKey(uniqueKey))
             {
                 // Unique key is NOT known, so create a new result object and 
process additional results.
 
@@ -92,7 +92,7 @@
 
                 if (buildObjects == null)
                 {
-                    buildObjects = new Hashtable();
+                    buildObjects = new Dictionary<string, object>();
                     request.SetUniqueKeys(resultMap, buildObjects);
                 }
                 buildObjects[uniqueKey] = outObject;

Modified: 
ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper/Model/ResultMapping/ResultMap.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper/Model/ResultMapping/ResultMap.cs?rev=657348&r1=657347&r2=657348&view=diff
==============================================================================
--- 
ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper/Model/ResultMapping/ResultMap.cs
 (original)
+++ 
ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper/Model/ResultMapping/ResultMap.cs
 Sat May 17 05:43:55 2008
@@ -284,10 +284,8 @@
         /// <summary>
         /// Create an instance Of result.
         /// </summary>
-        /// <param name="parameters">
-        /// An array of values that matches the number, order and type 
-        /// of the parameters for this constructor. 
-        /// </param>
+        /// <param name="parameters">An array of values that matches the 
number, order and type
+        /// of the parameters for this constructor.</param>
         /// <returns>An object.</returns>
         public object CreateInstanceOfResult(object[] parameters)
         {

Modified: ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper/Scope/RequestScope.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper/Scope/RequestScope.cs?rev=657348&r1=657347&r2=657348&view=diff
==============================================================================
--- ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper/Scope/RequestScope.cs 
(original)
+++ ibatis/trunk/cs/V2/src/Apache.Ibatis.DataMapper/Scope/RequestScope.cs Sat 
May 17 05:43:55 2008
@@ -63,8 +63,8 @@
         private IMappedStatement _mappedStatement = null;
         private int _currentResultMapIndex = -1;
         // Used by N+1 Select solution
-        // Holds [IResultMap, IDictionary] couple where the IDictionary holds 
[key, result object]
-        private IDictionary<IResultMap, IDictionary> _uniqueKeys = null;
+        // Holds [IResultMap, IDictionary] couple where the IDictionary holds 
[string key,object result]
+        private IDictionary<IResultMap, IDictionary<string,object>> 
_uniqueKeys = null;
 
         #endregion
 
@@ -75,16 +75,16 @@
         /// </summary>
         /// <param name="map">The ResultMap.</param>
         /// <returns>
-        /// Returns [key, result object] which holds the result objects that 
have  
+        /// Returns [string key, object result] which holds the result objects 
that have  
         /// already been build during this request with this <see 
cref="IResultMap"/>
         /// </returns>
-        public IDictionary GetUniqueKeys(IResultMap map)
+        public IDictionary<string, object> GetUniqueKeys(IResultMap map)
         {
             if (_uniqueKeys == null)
             {
                 return null;
             }
-            IDictionary keys = null;
+            IDictionary<string, object> keys = null;
             _uniqueKeys.TryGetValue(map, out keys);
             return keys;
         }
@@ -94,11 +94,11 @@
         /// </summary>
         /// <param name="map">The map.</param>
         /// <param name="keys">The keys.</param>
-        public void SetUniqueKeys(IResultMap map, IDictionary keys)
+        public void SetUniqueKeys(IResultMap map, IDictionary<string, object> 
keys)
         {
             if (_uniqueKeys == null)
             {
-                _uniqueKeys = new Dictionary<IResultMap,IDictionary>();
+                _uniqueKeys = new Dictionary<IResultMap, IDictionary<string, 
object>>();
             }
             _uniqueKeys.Add(map, keys);
         }


Reply via email to