ibatis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gba...@apache.org
Subject svn commit: r705306 - in /ibatis/trunk/cs/V3/src: Apache.Ibatis.Common/Configuration/ Apache.Ibatis.Common/Resources/ Apache.Ibatis.Common/Utilities/ Apache.Ibatis.Common/Utilities/Objects/ Apache.Ibatis.Common/Utilities/Objects/Members/ Apache.Ibatis....
Date Thu, 16 Oct 2008 18:14:47 GMT
Author: gbayon
Date: Thu Oct 16 11:14:45 2008
New Revision: 705306

URL: http://svn.apache.org/viewvc?rev=705306&view=rev
Log:
Minor refactoring

Modified:
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Configuration/ConfigurationCollection.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Resources/AssemblyResource.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/BaseAccessor.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/ReflectionInfo.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/TypeUtils.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/TypesResolver/TypeResolver.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/DefaultConfigurationEngine.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/DefaultModelBuilder.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildCacheModel.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildParameterMaps.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildResultMaps.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildStatements.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildTypeAlias.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildTypeHandlers.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/LoadSetting.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/ParameterMapModuleBuilder.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/ResultMapModuleBuilder.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/TypeAliasModuleBuilder.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/TypeHandlerModuleBuilder.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/ResultMapDeSerializer.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Data/DBHelperParameterCache.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/ArgumentStrategy/SelectGenericListStrategy.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PostSelectStrategy/GenericListStrategy.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/CacheKey.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/ArgumentPropertyCollection.cs
    ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/ResultPropertyCollection.cs

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Configuration/ConfigurationCollection.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Configuration/ConfigurationCollection.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Configuration/ConfigurationCollection.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Configuration/ConfigurationCollection.cs Thu
Oct 16 11:14:45 2008
@@ -43,11 +43,11 @@
         {
             get
             {
-                foreach(IConfiguration config in this)
+                for(int i=0;i<Count;i++)
                 {
-                    if (id.Equals(config.Id))
+                    if (id.Equals(this[i].Id))
                     {
-                        return config;
+                        return this[i];
                     }
                 }
 
@@ -64,11 +64,11 @@
         {
             ConfigurationCollection liste = new ConfigurationCollection();
 
-            foreach (IConfiguration config in this)
+            for (int i = 0; i < Count; i++)
             {
-                if (elementType.Equals(config.Type))
+                if (elementType.Equals(this[i].Type))
                 {
-                    liste.Add( config );
+                    liste.Add(this[i]);
                 }
             }
 
@@ -85,13 +85,13 @@
         {
             ConfigurationCollection list = new ConfigurationCollection();
 
-            foreach (IConfiguration config in this)
+            for (int i = 0; i < Count; i++)
             {
-                if (elementType.Equals(config.Type))
+                if (elementType.Equals(this[i].Type))
                 {
-                    list.Add(config);
+                    list.Add(this[i]);
                 }
-                list.AddRange(config.Children.RecursiveFind(elementType));
+                list.AddRange(this[i].Children.RecursiveFind(elementType));
             }
 
             return list;
@@ -107,11 +107,11 @@
         public ConfigurationCollection Remove(string elementType)
         {
             ConfigurationCollection newCollection = new ConfigurationCollection();
-            foreach (IConfiguration configuration in this)
+            for (int i = 0; i < Count; i++)
             {
-                if (configuration.Type != elementType)
+                if (this[i].Type != elementType)
                 {
-                    newCollection.Add(configuration);
+                    newCollection.Add(this[i]);
                 }
             }
             return newCollection;

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Resources/AssemblyResource.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Resources/AssemblyResource.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Resources/AssemblyResource.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Resources/AssemblyResource.cs Thu Oct 16 11:14:45
2008
@@ -159,8 +159,9 @@
                 {
                     // bare type name... loop thru all loaded assemblies
                     Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
-                    foreach (Assembly ass in assemblies)
+                    for (int i = 0; i < assemblies.Length; i++)
                     {
+                        Assembly ass = assemblies[i];
                         stream = ass.GetManifestResourceStream(fullResourceName);
                         if (stream == null)
                         {

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/BaseAccessor.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/BaseAccessor.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/BaseAccessor.cs
(original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/Members/BaseAccessor.cs
Thu Oct 16 11:14:45 2008
@@ -94,8 +94,9 @@
                     // JIRA 210
                     // Fix for interface inheriting
                     // Loop through interfaces of the type
-                    foreach (Type interfaceType in target.GetInterfaces())
+                    for (int i = 0; i < target.GetInterfaces().Length; i++)
                     {
+                        Type interfaceType = target.GetInterfaces()[i];
                         // Get propertyinfo and if found the break out of loop
                         propertyInfo = GetPropertyInfo(interfaceType);
                         if (propertyInfo != null)

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/ReflectionInfo.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/ReflectionInfo.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/ReflectionInfo.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/Objects/ReflectionInfo.cs Thu Oct
16 11:14:45 2008
@@ -181,9 +181,9 @@
             {
                 // Loop through interfaces for the type and add members from
                 // these types too
-                foreach (Type interf in type.GetInterfaces())
+                for (int i = 0; i < type.GetInterfaces().Length; i++)
                 {
-                    AddMembers(interf);
+                    AddMembers(type.GetInterfaces()[i]);
                 }
             }
 		}

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/TypeUtils.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/TypeUtils.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/TypeUtils.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/TypeUtils.cs Thu Oct 16 11:14:45
2008
@@ -258,9 +258,9 @@
             }
             // check if one of the derived interfaces is IList<>
             Type[] interfaceTypes = type.GetInterfaces();
-            foreach (Type interfaceType in interfaceTypes)
+            for (int i = 0; i < interfaceTypes.Length; i++)
             {
-                ret = IsImplementGenericIListInterface(interfaceType);
+                ret = IsImplementGenericIListInterface(interfaceTypes[i]);
                 if (ret)
                 {
                     break;

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/TypesResolver/TypeResolver.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/TypesResolver/TypeResolver.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/TypesResolver/TypeResolver.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.Common/Utilities/TypesResolver/TypeResolver.cs Thu
Oct 16 11:14:45 2008
@@ -231,9 +231,10 @@
         {
             Type type = null;
             Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
-            foreach (Assembly assembly in assemblies)
+
+            for (int i = 0; i < assemblies.Length; i++)
             {
-                type = assembly.GetType(typeInfo.TypeName, false, false);
+                type = assemblies[i].GetType(typeInfo.TypeName, false, false);
                 if (type != null)
                 {
                     break;
@@ -343,9 +344,9 @@
                     if (_unresolvedGenericArguments == null)
                         return false;
 
-                    foreach (string arg in _unresolvedGenericArguments)
+                    for (int i = 0; i < _unresolvedGenericArguments.Length; i++)
                     {
-                        if (arg.Length > 0)
+                        if (_unresolvedGenericArguments[i].Length > 0)
                             return false;
                     }
                     return true;

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/DefaultConfigurationEngine.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/DefaultConfigurationEngine.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/DefaultConfigurationEngine.cs
(original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/DefaultConfigurationEngine.cs
Thu Oct 16 11:14:45 2008
@@ -166,29 +166,29 @@
             }
 
             // Registers code configuration element
-            foreach (IModule module in modules)
+            for(int i=0;i<modules.Count;i++)
             {
-                module.Configure(this);
+                modules[i].Configure(this);
             }
 
             // Process Extends ResultMap
             List<IConfiguration> resolved = new List<IConfiguration>();
-            foreach (IConfiguration resultMap in configurationStore.ResultMaps)
+            for (int i = 0; i < configurationStore.ResultMaps.Length; i++)
             {
-                ResolveExtendResultMap(resolved, resultMap);
+                ResolveExtendResultMap(resolved, configurationStore.ResultMaps[i]);
             }
 
             // Process Extends ParameterMap
             resolved = new List<IConfiguration>();
-            foreach (IConfiguration parameterMap in configurationStore.ParameterMaps)
+            for (int i = 0; i < configurationStore.ParameterMaps.Length; i++)
             {
-                ResolveExtendParameterMap(resolved, parameterMap);
+                ResolveExtendParameterMap(resolved, configurationStore.ParameterMaps[i]);
             }
 
             // Process Include Sql statement
-            foreach (IConfiguration statement in configurationStore.Statements)
+            for (int i = 0; i < configurationStore.Statements.Length; i++)
             {
-                ConfigurationCollection includes = statement.Children.RecursiveFind(ConfigConstants.ELEMENT_INCLUDE);
+                ConfigurationCollection includes = configurationStore.Statements[i].Children.RecursiveFind(ConfigConstants.ELEMENT_INCLUDE);
 
                 if (includes.Count > 0)
                 {
@@ -198,9 +198,9 @@
 
             // Process Extends statement
             resolved = new List<IConfiguration>();
-            foreach (IConfiguration statement in configurationStore.Statements)
+            for (int i = 0; i < configurationStore.Statements.Length; i++)
             {
-                ResolveExtendStatement(resolved, statement);
+                ResolveExtendStatement(resolved, configurationStore.Statements[i]);
             }
 
             modelStore = new DefaultModelStore();
@@ -271,14 +271,15 @@
 
         private void ResolveIncludeStatement(ConfigurationCollection includes)
         {
-            foreach (IConfiguration include in includes)
+            for (int i = 0; i < includes.Count;i++ )
             {
-              IConfiguration toInclude =
-                        configurationStore.GetStatementConfiguration(include.Id);
-              if (toInclude == null)
-              {
-                  throw new ConfigurationException("There's no include statement named '"
+ include.Id + "'");
-              }
+                IConfiguration include = includes[i];
+                IConfiguration toInclude =
+                          configurationStore.GetStatementConfiguration(include.Id);
+                if (toInclude == null)
+                {
+                    throw new ConfigurationException("There's no include statement named
'" + include.Id + "'");
+                }
                 IConfiguration parent = include.Parent;
                 int childIndex = include.Parent.Children.IndexOf(include);
                 parent.Children.RemoveAt(childIndex);

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/DefaultModelBuilder.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/DefaultModelBuilder.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/DefaultModelBuilder.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/DefaultModelBuilder.cs Thu
Oct 16 11:14:45 2008
@@ -42,7 +42,6 @@
 using Apache.Ibatis.DataMapper.Configuration.Serializers;
 using Apache.Ibatis.DataMapper.Session;
 using Apache.Ibatis.DataMapper.Model.ResultMapping;
-using Apache.Ibatis.Common.Configuration;
 using Apache.Ibatis.DataMapper.Model.Cache;
 using Apache.Ibatis.DataMapper.MappedStatements;
 using Apache.Ibatis.Common.Logging;
@@ -201,21 +200,27 @@
             BuildTypeHandlers(store);
             BuildCacheModels(store);
             BuildResultMaps(store);
-            foreach (ResultProperty property in nestedProperties)
+
+            for (int i = 0; i < nestedProperties.Count; i++)
             {
+                ResultProperty property = nestedProperties[i];
                 property.NestedResultMap = modelStore.GetResultMap(property.NestedResultMapName);
             }
-            foreach (Discriminator discriminator in discriminators)
+
+            for (int i = 0; i < discriminators.Count; i++)
             {
-                discriminator.Initialize(modelStore);
+                discriminators[i].Initialize(modelStore);
             }
             BuildParameterMaps(store);
             BuildMappedStatements(store);
-            foreach (IConfiguration cacheConfig in store.CacheModels)
+
+            for (int i = 0; i < store.CacheModels.Length; i++)
             {
-                CacheModel cacheModel = modelStore.GetCacheModel(cacheConfig.Id);
-                foreach (string statement in cacheModel.StatementFlushNames)
+                CacheModel cacheModel = modelStore.GetCacheModel(store.CacheModels[i].Id);
+
+                for (int j = 0; j < cacheModel.StatementFlushNames.Count; j++)
                 {
+                    string statement = cacheModel.StatementFlushNames[j];
                     IMappedStatement mappedStatement = modelStore.GetMappedStatement(statement);
                     if (mappedStatement != null)
                     {

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildCacheModel.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildCacheModel.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildCacheModel.cs
(original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildCacheModel.cs
Thu Oct 16 11:14:45 2008
@@ -40,17 +40,18 @@
         /// <param name="store">The store.</param>
         private void BuildCacheModels(IConfigurationStore store)
         {
-            foreach (IConfiguration cacheModelConfig in store.CacheModels)
+            for(int i=0;i<store.CacheModels.Length;i++)
             {
+                IConfiguration cacheModelConfig = store.CacheModels[i];
                 CacheModel cacheModel = CacheModelDeSerializer.Deserialize(cacheModelConfig,
modelStore.DataExchangeFactory);
 
                 string nameSpace = ConfigurationUtils.GetMandatoryStringAttribute(cacheModelConfig,
ConfigConstants.ATTRIBUTE_NAMESPACE);
 
                 // Gets all the flush on excecute statement id
                 ConfigurationCollection flushConfigs = cacheModelConfig.Children.Find(ConfigConstants.ELEMENT_FLUSHONEXECUTE);
-                foreach (IConfiguration flushOnExecute in flushConfigs)
+                for (int j = 0; j < flushConfigs.Count; j++)
                 {
-                    string statementId= flushOnExecute.Attributes[ConfigConstants.ATTRIBUTE_STATEMENT];
+                    string statementId = flushConfigs[j].Attributes[ConfigConstants.ATTRIBUTE_STATEMENT];
                     if (useStatementNamespaces)
                     {
                         statementId = ApplyNamespace(nameSpace, statementId);
@@ -74,8 +75,10 @@
 
             // Get Properties 
             ConfigurationCollection propertiesConfigs = cacheModelConfiguration.Children.Find(ConfigConstants.ELEMENT_PROPERTY);
-            foreach (IConfiguration propertie in propertiesConfigs)
+
+            for (int i = 0; i < propertiesConfigs.Count; i++)
             {
+                IConfiguration propertie = propertiesConfigs[i];
                 string name = propertie.Attributes[ConfigConstants.ATTRIBUTE_NAME];
                 string value = propertie.Attributes[ConfigConstants.ATTRIBUTE_VALUE];
 

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildParameterMaps.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildParameterMaps.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildParameterMaps.cs
(original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildParameterMaps.cs
Thu Oct 16 11:14:45 2008
@@ -41,8 +41,9 @@
         /// <param name="store">The store.</param>
         private void BuildParameterMaps(IConfigurationStore store)
         {
-            foreach (IConfiguration parameterMapConfig in store.ParameterMaps)
+            for (int i = 0; i < store.ParameterMaps.Length; i++)
             {
+                IConfiguration parameterMapConfig = store.ParameterMaps[i];
                 ParameterMap parameterMap = ParameterMapDeSerializer.Deserialize(modelStore.DataExchangeFactory,
parameterMapConfig, modelStore);
 
                 BuildParameterProperties(parameterMap, parameterMapConfig);
@@ -59,8 +60,9 @@
         private void BuildParameterProperties(ParameterMap parameterMap, IConfiguration parameterMapConfig)
         {
             ConfigurationCollection parametersConfig = parameterMapConfig.Children.Find(ConfigConstants.ELEMENT_PARAMETER);
-            foreach (IConfiguration parameterConfig in parametersConfig)
+            for (int i = 0; i < parametersConfig.Count; i++)
             {
+                IConfiguration parameterConfig = parametersConfig[i];
                 ParameterProperty property = null;
                 try
                 {

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildResultMaps.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildResultMaps.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildResultMaps.cs
(original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildResultMaps.cs
Thu Oct 16 11:14:45 2008
@@ -37,10 +37,10 @@
         /// <param name="store">The store.</param>
         private void BuildResultMaps(IConfigurationStore store)
         {
-            foreach (IConfiguration resultMapConfig in store.ResultMaps)
+            for (int i = 0; i < store.ResultMaps.Length; i++)
             {
                 ResultMap resultMap = ResultMapDeSerializer.Deserialize(
-                    resultMapConfig,
+                    store.ResultMaps[i],
                     modelStore.DataExchangeFactory,
                     waitResultPropertyResolution,
                     waitDiscriminatorResolution);

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildStatements.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildStatements.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildStatements.cs
(original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildStatements.cs
Thu Oct 16 11:14:45 2008
@@ -54,8 +54,9 @@
         /// <param name="store">The store.</param>
         private void BuildMappedStatements(IConfigurationStore store)
         {
-            foreach (IConfiguration statementConfig in store.Statements)
+            for (int i = 0; i < store.Statements.Length; i++)
             {
+                IConfiguration statementConfig = store.Statements[i];
                 IMappedStatement mappedStatement = null;
 
                 switch (statementConfig.Type)

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildTypeAlias.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildTypeAlias.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildTypeAlias.cs
(original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildTypeAlias.cs
Thu Oct 16 11:14:45 2008
@@ -39,10 +39,10 @@
         {
             //_configScope.ErrorContext.Resource = nodeDataSource.OuterXml.ToString();
             //_configScope.ErrorContext.MoreInfo = "parse DataSource";
-            
-            foreach(IConfiguration aliasConfig in store.Alias)
+
+            for (int i = 0; i < store.Alias.Length; i++)
             {
-                TypeAlias typeAlias = TypeAliasDeSerializer.Deserialize(aliasConfig);
+                TypeAlias typeAlias = TypeAliasDeSerializer.Deserialize(store.Alias[i]);
                 modelStore.DataExchangeFactory.TypeHandlerFactory.AddTypeAlias(typeAlias.Id,
typeAlias);
             }
         }

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildTypeHandlers.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildTypeHandlers.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildTypeHandlers.cs
(original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/BuildTypeHandlers.cs
Thu Oct 16 11:14:45 2008
@@ -41,8 +41,9 @@
         /// <param name="store">The store.</param>
         private void BuildTypeHandlers(IConfigurationStore store)
         {
-            foreach (IConfiguration handlerConfig in store.TypeHandlers)
+            for (int i = 0; i < store.TypeHandlers.Length ; i++)
             {
+                IConfiguration handlerConfig = store.TypeHandlers[i];
                 try
                 {
                     //_configScope.ErrorContext.Activity = "loading typeHandler";

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/LoadSetting.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/LoadSetting.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/LoadSetting.cs
(original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/ModelBuilder/LoadSetting.cs
Thu Oct 16 11:14:45 2008
@@ -42,8 +42,9 @@
         {
             if (store.Settings.Count > 0)
             {
-                foreach (IConfiguration setting in store.Settings)
+                for (int i = 0; i < store.Settings.Count; i++)
                 {
+                    IConfiguration setting = store.Settings[i];
                     if (setting.Id == ConfigConstants.ATTRIBUTE_USE_STATEMENT_NAMESPACES)
                     {
                         useStatementNamespaces = Convert.ToBoolean(setting.Value);

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/ParameterMapModuleBuilder.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/ParameterMapModuleBuilder.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/ParameterMapModuleBuilder.cs
(original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/ParameterMapModuleBuilder.cs
Thu Oct 16 11:14:45 2008
@@ -62,9 +62,9 @@
 
         private void BuildParameterMap(IConfigurationStore configurationStore)
         {
-            foreach (IConfiguration configuration in store.ParameterMaps)
+            for (int i = 0; i < store.ParameterMaps.Length; i++)
             {
-                configurationStore.AddParameterMapConfiguration(configuration);
+                configurationStore.AddParameterMapConfiguration(store.ParameterMaps[i]);
             }
         }
     }

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/ResultMapModuleBuilder.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/ResultMapModuleBuilder.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/ResultMapModuleBuilder.cs
(original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/ResultMapModuleBuilder.cs
Thu Oct 16 11:14:45 2008
@@ -62,9 +62,9 @@
 
         private void BuildResultMap(IConfigurationStore configurationStore)
         {
-            foreach (IConfiguration configuration in store.ResultMaps)
+            for (int i = 0; i < store.ResultMaps.Length; i++)
             {
-                configurationStore.AddResultMapConfiguration(configuration);
+                configurationStore.AddResultMapConfiguration(store.ResultMaps[i]);
             }
         }
     }

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/TypeAliasModuleBuilder.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/TypeAliasModuleBuilder.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/TypeAliasModuleBuilder.cs
(original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/TypeAliasModuleBuilder.cs
Thu Oct 16 11:14:45 2008
@@ -77,9 +77,9 @@
 
         private void BuildTypeAlias(IConfigurationStore configurationStore)
         {
-            foreach(IConfiguration configuration in store.Alias)
+            for (int i = 0; i < store.Alias.Length; i++)
             {
-                configurationStore.AddAliasConfiguration(configuration);
+                configurationStore.AddAliasConfiguration(store.Alias[i]);
             }
         }
     }

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/TypeHandlerModuleBuilder.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/TypeHandlerModuleBuilder.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/TypeHandlerModuleBuilder.cs
(original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Module/TypeHandlerModuleBuilder.cs
Thu Oct 16 11:14:45 2008
@@ -83,9 +83,9 @@
 
         private void BuildTypeHandler(IConfigurationStore configurationStore)
         {
-            foreach (IConfiguration configuration in store.TypeHandlers)
+            for (int i = 0; i < store.TypeHandlers.Length; i++)
             {
-                configurationStore.AddTypeHandlerConfiguration(configuration);
+                configurationStore.AddTypeHandlerConfiguration(store.TypeHandlers[i]);
             }
         }
     }

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/ResultMapDeSerializer.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/ResultMapDeSerializer.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/ResultMapDeSerializer.cs
(original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Configuration/Serializers/ResultMapDeSerializer.cs
Thu Oct 16 11:14:45 2008
@@ -171,9 +171,9 @@
         private static ConstructorInfo GetConstructor(string resultMapId, Type type, string[]
parametersName)
         {
             ConstructorInfo[] candidates = type.GetConstructors(ANY_VISIBILITY_INSTANCE);
-            foreach (ConstructorInfo constructor in candidates)
+            for (int i = 0; i < candidates.Length; i++)
             {
-                ParameterInfo[] parameters = constructor.GetParameters();
+                ParameterInfo[] parameters = candidates[i].GetParameters();
 
                 if (parameters.Length == parametersName.Length)
                 {
@@ -191,7 +191,7 @@
 
                     if (found)
                     {
-                        return constructor;
+                        return candidates[i];
                     }
                 }
             }
@@ -221,16 +221,16 @@
             ResultPropertyCollection properties = new ResultPropertyCollection();
 
             ConfigurationCollection resultsConfig = resultMapConfig.Children.Find(ConfigConstants.ELEMENT_RESULT);
-            foreach (IConfiguration result in resultsConfig)
+            for (int i = 0; i < resultsConfig.Count; i++)
             {
                 ResultProperty mapping = null;
                 try
                 {
-                    mapping = ResultPropertyDeSerializer.Deserialize(result, resultClass,
prefix, suffix, dataExchangeFactory);
+                    mapping = ResultPropertyDeSerializer.Deserialize(resultsConfig[i], resultClass,
prefix, suffix, dataExchangeFactory);
                 }
                 catch(Exception e)
                 {
-                    throw new ConfigurationException("In ResultMap (" + resultMapId + ")
can't build the result property: " + ConfigurationUtils.GetStringAttribute(result.Attributes,
ConfigConstants.ATTRIBUTE_PROPERTY) + ". Cause " + e.Message, e);
+                    throw new ConfigurationException("In ResultMap (" + resultMapId + ")
can't build the result property: " + ConfigurationUtils.GetStringAttribute(resultsConfig[i].Attributes,
ConfigConstants.ATTRIBUTE_PROPERTY) + ". Cause " + e.Message, e);
                 }
                 if (mapping.NestedResultMapName.Length > 0)
                 {
@@ -267,9 +267,9 @@
                 // Find the cases
                 IList<Case> cases = new List<Case>();
                 ConfigurationCollection caseConfigs = discriminatorsConfig[0].Children.Find(ConfigConstants.ELEMENT_CASE);
-                foreach (IConfiguration caseConfig in caseConfigs)
+                for (int i = 0; i < caseConfigs.Count; i++)
                 {
-                    Case caseElement = CaseDeSerializer.Deserialize(caseConfig);
+                    Case caseElement = CaseDeSerializer.Deserialize(caseConfigs[i]);
                     cases.Add(caseElement);
                 }
 

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Data/DBHelperParameterCache.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Data/DBHelperParameterCache.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Data/DBHelperParameterCache.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Data/DBHelperParameterCache.cs Thu Oct
16 11:14:45 2008
@@ -25,7 +25,6 @@
 #endregion
 
 using System;
-using System.Collections;
 using System.Data;
 using System.Reflection;
 using Apache.Ibatis.Common.Exceptions;
@@ -54,7 +53,7 @@
         /// <param name="spName">the name of the stored procedure</param>
         /// <param name="includeReturnValueParameter">whether or not to include their
return value parameter</param>
         /// <returns></returns>
-        private IDataParameter[] DiscoverSpParameterSet(ISession session, string spName,
bool includeReturnValueParameter)
+        private static IDataParameter[] DiscoverSpParameterSet(ISession session, string spName,
bool includeReturnValueParameter)
 		{
 			return InternalDiscoverSpParameterSet(
                 session,
@@ -71,7 +70,7 @@
         /// <param name="spName">Name of the stored procedure.</param>
         /// <param name="includeReturnValueParameter">if set to <c>true</c>
[include return value parameter].</param>
         /// <returns>The stored procedure parameters.</returns>
-		private IDataParameter[] InternalDiscoverSpParameterSet(
+		private static IDataParameter[] InternalDiscoverSpParameterSet(
             ISession session, 
             string spName, 
             bool includeReturnValueParameter)
@@ -112,19 +111,27 @@
 				return discoveredParameters;
 			}
 		}
-		
-		private void DeriveParameters(IDbProvider provider, IDbCommand command)
-		{
-			Type commandBuilderType;
 
-			// Find the CommandBuilder
-			if (provider == null)
-				throw new ArgumentNullException("provider");
-			if ((provider.CommandBuilderClass == null) || (provider.CommandBuilderClass.Length <
1))
-				throw new Exception(String.Format(
-					"CommandBuilderClass not defined for provider \"{0}\".",
-					provider.Id));
-			commandBuilderType = provider.CommandBuilderType;
+        /// <summary>
+        /// Derives the parameters.
+        /// </summary>
+        /// <param name="provider">The provider.</param>
+        /// <param name="command">The command.</param>
+		private static void DeriveParameters(IDbProvider provider, IDbCommand command)
+        {
+            // Find the CommandBuilder
+            if (provider == null)
+            {
+                throw new ArgumentNullException("provider");
+            }
+            if (string.IsNullOrEmpty(provider.CommandBuilderClass))
+            {
+                throw new Exception(String.Format(
+                                        "CommandBuilderClass not defined for provider \"{0}\".",
+                                        provider.Id));
+            }
+
+	        Type commandBuilderType = provider.CommandBuilderType;
 
 			// Invoke the static DeriveParameter method on the CommandBuilder class
 			// NOTE: OracleCommandBuilder has no DeriveParameter method
@@ -145,7 +152,7 @@
 		/// </summary>
 		/// <param name="originalParameters"></param>
 		/// <returns></returns>
-		private IDataParameter[] CloneParameters(IDataParameter[] originalParameters)
+		private static IDataParameter[] CloneParameters(IDataParameter[] originalParameters)
 		{
 			IDataParameter[] clonedParameters = new IDataParameter[originalParameters.Length];
 
@@ -204,10 +211,7 @@
 			{			
 				return null;
 			}
-			else
-			{
-				return CloneParameters(cachedParameters);
-			}
+		    return CloneParameters(cachedParameters);
 		}
 
 		#endregion caching functions

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/ArgumentStrategy/SelectGenericListStrategy.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/ArgumentStrategy/SelectGenericListStrategy.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/ArgumentStrategy/SelectGenericListStrategy.cs
(original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/ArgumentStrategy/SelectGenericListStrategy.cs
Thu Oct 16 11:14:45 2008
@@ -69,13 +69,13 @@
 
             MethodInfo[] mis = mappedStatementType.GetMethods(BindingFlags.InvokeMethod |
BindingFlags.Public | BindingFlags.Instance);
             MethodInfo mi = null;
-            foreach (MethodInfo m in mis)
+            for (int i = 0; i < mis.Length; i++)
             {
-                if (m.IsGenericMethod &&
-                    m.Name == "ExecuteQueryForList" &&
-                    m.GetParameters().Length == 2)
+                if (mis[i].IsGenericMethod &&
+                    mis[i].Name == "ExecuteQueryForList" &&
+                    mis[i].GetParameters().Length == 2)
                 {
-                    mi = m;
+                    mi = mis[i];
                     break;
                 }
             }

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PostSelectStrategy/GenericListStrategy.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PostSelectStrategy/GenericListStrategy.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PostSelectStrategy/GenericListStrategy.cs
(original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/MappedStatements/PostSelectStrategy/GenericListStrategy.cs
Thu Oct 16 11:14:45 2008
@@ -57,13 +57,13 @@
 
             MethodInfo[] mis = mappedStatementType.GetMethods(BindingFlags.InvokeMethod |
BindingFlags.Public | BindingFlags.Instance);
             MethodInfo mi = null;
-            foreach (MethodInfo m in mis)
+            for (int i = 0; i < mis.Length; i++)
             {
-                if (m.IsGenericMethod &&
-                    m.Name == "ExecuteQueryForList" &&
-                    m.GetParameters().Length == 2)
+                if (mis[i].IsGenericMethod &&
+                    mis[i].Name == "ExecuteQueryForList" &&
+                    mis[i].GetParameters().Length == 2)
                 {
-                    mi = m;
+                    mi = mis[i];
                     break;
                 }
             }

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/CacheKey.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/CacheKey.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/CacheKey.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/CacheKey.cs Thu Oct 16 11:14:45
2008
@@ -90,9 +90,9 @@
         /// <param name="objects">The objects.</param>
           public void UpdateAll(object[] objects) 
           {
-                foreach(object o in objects) 
+                for(int i=0; i<objects.Length;i++) 
                 {
-                  Update(o);
+                    Update(objects[i]);
                 }
             }
 

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/ArgumentPropertyCollection.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/ArgumentPropertyCollection.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/ArgumentPropertyCollection.cs
(original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/ArgumentPropertyCollection.cs
Thu Oct 16 11:14:45 2008
@@ -39,9 +39,9 @@
         /// <returns>True if is in else false</returns>
         public bool Contains(string argumentName)
         {
-            foreach (ArgumentProperty argumentProperty in this)
+            for(int i=0;i<Count;i++)
             {
-                if (argumentProperty.ArgumentName == argumentName)
+                if (this[i].ArgumentName == argumentName)
                 {
                     return true;
                 }
@@ -57,11 +57,11 @@
         public ArgumentProperty FindByPropertyName(string argumentName)
         {
             ArgumentProperty argumentProperty = null;
-            foreach (ArgumentProperty argument in this)
+            for (int i = 0; i < Count; i++)
             {
-                if (argument.ArgumentName == argumentName)
+                if (this[i].ArgumentName == argumentName)
                 {
-                    argumentProperty = argument;
+                    argumentProperty = this[i];
                     break;
                 }
             }

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/ResultPropertyCollection.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/ResultPropertyCollection.cs?rev=705306&r1=705305&r2=705306&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/ResultPropertyCollection.cs
(original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/ResultMapping/ResultPropertyCollection.cs
Thu Oct 16 11:14:45 2008
@@ -39,9 +39,9 @@
         /// <returns>True if is in else false</returns>
         public bool Contains(string propertyName)
         {
-            foreach (ResultProperty resultProperty in this)
+            for (int i = 0; i < Count; i++)
             {
-                if (resultProperty.PropertyName == propertyName)
+                if (this[i].PropertyName == propertyName)
                 {
                     return true;
                 }
@@ -57,11 +57,11 @@
         public ResultProperty FindByPropertyName(string propertyName)
         {
             ResultProperty resultProperty = null;
-            foreach (ResultProperty property in this)
+            for (int i = 0; i < Count; i++)
             {
-                if (property.PropertyName == propertyName)
+                if (this[i].PropertyName == propertyName)
                 {
-                    resultProperty = property;
+                    resultProperty = this[i];
                     break;
                 }
             }



Mime
View raw message