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/05/31 19:40:08 UTC

svn commit: r410610 - in /ibatis/trunk/cs/mapper: IBatisNet.Common.Test/ IBatisNet.Common.Test/Domain/ IBatisNet.Common.Test/NUnit/CommonTests/Utilities/ IBatisNet.Common/ IBatisNet.Common/Utilities/Objects/ IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClie...

Author: gbayon
Date: Wed May 31 10:40:07 2006
New Revision: 410610

URL: http://svn.apache.org/viewvc?rev=410610&view=rev
Log:
- Fixed IFactory for abstract Class
- The class attribute made required on ParameterMap tag is now just recommended as in previous version

Added:
    ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Book.cs   (with props)
    ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Document.cs   (with props)
    ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/AbstractFactory.cs   (with props)
Modified:
    ibatis/trunk/cs/mapper/IBatisNet.Common.Test/IBatisNet.Common.Test.2005.csproj
    ibatis/trunk/cs/mapper/IBatisNet.Common.Test/IBatisNet.Common.Test.csproj
    ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/ObjectFactoryTest.cs
    ibatis/trunk/cs/mapper/IBatisNet.Common/IBatisNet.Common.2005.csproj
    ibatis/trunk/cs/mapper/IBatisNet.Common/IBatisNet.Common.csproj
    ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/DelegateFactory.cs
    ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/DelegateObjectFactory.cs
    ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/EmitObjectFactory.cs
    ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/FactoryBuilder.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/MSSQL/ProcedureTest.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/ChangeLog.txt
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Commands/DefaultPreparedCommand.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/ParameterMap.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/ParameterMapDeSerializer.cs

Added: ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Book.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Book.cs?rev=410610&view=auto
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Book.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Book.cs Wed May 31 10:40:07 2006
@@ -0,0 +1,12 @@
+namespace IBatisNet.Common.Test.Domain
+{
+	/// <summary>
+	/// Summary description for Book.
+	/// </summary>
+	public class Book : Document 
+	{
+		public Book()
+		{
+		}
+	}
+}

Propchange: ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Book.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Book.cs
------------------------------------------------------------------------------
    svn:keywords = Id LastChangedDate LastChangedBy

Added: ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Document.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Document.cs?rev=410610&view=auto
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Document.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Document.cs Wed May 31 10:40:07 2006
@@ -0,0 +1,18 @@
+using System;
+
+namespace IBatisNet.Common.Test.Domain
+{
+	/// <summary>
+	/// Summary description for Document.
+	/// </summary>
+	public abstract class Document
+	{
+		private DateTime _date = DateTime.MinValue;
+		
+		public DateTime Creation
+		{
+			get { return _date;}
+			set { _date = value;}
+		}
+	}
+}

Propchange: ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Document.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Document.cs
------------------------------------------------------------------------------
    svn:keywords = Id LastChangedDate LastChangedBy

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common.Test/IBatisNet.Common.Test.2005.csproj
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common.Test/IBatisNet.Common.Test.2005.csproj?rev=410610&r1=410609&r2=410610&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common.Test/IBatisNet.Common.Test.2005.csproj (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common.Test/IBatisNet.Common.Test.2005.csproj Wed May 31 10:40:07 2006
@@ -100,6 +100,8 @@
     <Compile Include="Domain\Account.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Domain\Book.cs" />
+    <Compile Include="Domain\Document.cs" />
     <Compile Include="Domain\Item.cs" />
     <Compile Include="Domain\Order.cs" />
     <Compile Include="Domain\Property.cs" />

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common.Test/IBatisNet.Common.Test.csproj
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common.Test/IBatisNet.Common.Test.csproj?rev=410610&r1=410609&r2=410610&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common.Test/IBatisNet.Common.Test.csproj (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common.Test/IBatisNet.Common.Test.csproj Wed May 31 10:40:07 2006
@@ -212,6 +212,16 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = "Domain\Book.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Domain\Document.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "Domain\Item.cs"
                     SubType = "Code"
                     BuildAction = "Compile"

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/ObjectFactoryTest.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/ObjectFactoryTest.cs?rev=410610&r1=410609&r2=410610&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/ObjectFactoryTest.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/ObjectFactoryTest.cs Wed May 31 10:40:07 2006
@@ -11,6 +11,27 @@
 	public class ObjectFactoryTest
 	{
 		[Test]
+        [ExpectedException(typeof(ProbeException))]
+		public void AbstractConstructor()
+		{
+			IObjectFactory objectFactory = new ObjectFactory(true);
+
+			IFactory factory = objectFactory.CreateFactory(typeof (Document), Type.EmptyTypes );
+
+            object obj = factory.CreateInstance(null);
+		}
+    	
+		[Test]
+		public void DevivedClassConstructor()
+		{
+			IObjectFactory objectFactory = new ObjectFactory(true);
+
+			IFactory factory = objectFactory.CreateFactory(typeof (Book), Type.EmptyTypes );
+
+			Assert.IsNotNull(factory);
+		}
+    	
+		[Test]
 		[ExpectedException(typeof(ProbeException))]
 		public void PrivateConstructor()
 		{
@@ -298,7 +319,6 @@
 				+ "\nNew : \t\t\t" + newFactoryResult.ToString("F3")
 				+ "\nActivator : \t\t" + activatorFactoryResult.ToString("F3")+ " Ratio : " + ((activatorFactoryResult / newFactoryResult)).ToString("F3")
 				+ "\nEmit IL : \t\t\t" + emitFactoryResult.ToString("F3") + " Ratio : " + ((emitFactoryResult / newFactoryResult)).ToString("F3"));
-
 		}
 
 		internal class NewAccountFactory : IFactory

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common/IBatisNet.Common.2005.csproj
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common/IBatisNet.Common.2005.csproj?rev=410610&r1=410609&r2=410610&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/IBatisNet.Common.2005.csproj (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/IBatisNet.Common.2005.csproj Wed May 31 10:40:07 2006
@@ -192,6 +192,7 @@
     <Compile Include="Utilities\HashCodeProvider.cs">
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="Utilities\Objects\AbstractFactory.cs" />
     <Compile Include="Utilities\Objects\ActivatorFactory.cs" />
     <Compile Include="Utilities\Objects\ActivatorObjectFactory.cs" />
     <Compile Include="Utilities\Objects\BoxingOpCodes.cs" />

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common/IBatisNet.Common.csproj
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common/IBatisNet.Common.csproj?rev=410610&r1=410609&r2=410610&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/IBatisNet.Common.csproj (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/IBatisNet.Common.csproj Wed May 31 10:40:07 2006
@@ -305,6 +305,11 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = "Utilities\Objects\AbstractFactory.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "Utilities\Objects\ActivatorFactory.cs"
                     SubType = "Code"
                     BuildAction = "Compile"

Added: ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/AbstractFactory.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/AbstractFactory.cs?rev=410610&view=auto
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/AbstractFactory.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/AbstractFactory.cs Wed May 31 10:40:07 2006
@@ -0,0 +1,67 @@
+#region Apache Notice
+/*****************************************************************************
+ * $Revision: 374175 $
+ * $LastChangedDate$
+ * $LastChangedBy$
+ * 
+ * iBATIS.NET Data Mapper
+ * Copyright (C) 2006/2005 - The Apache Software Foundation
+ *  
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ ********************************************************************************/
+#endregion
+
+using System;
+using IBatisNet.Common.Exceptions;
+
+namespace IBatisNet.Common.Utilities.Objects
+{
+	/// <summary>
+	/// A <see cref="IObjectFactory"/> implementation that for abstract type
+	/// </summary>
+    public class AbstractFactory : IFactory
+    {
+        private Type _typeToCreate = null;
+        
+        /// <summary>
+        /// Initializes a new instance of the <see cref="AbstractFactory"/> class.
+        /// </summary>
+        /// <param name="typeToCreate">The type to create.</param>
+        public AbstractFactory(Type typeToCreate)
+        {
+            _typeToCreate = typeToCreate;
+        }
+        
+        #region IFactory Members
+
+        /// <summary>
+        /// Create a new instance with the specified parameters
+        /// </summary>
+        /// <param name="parameters">An array of values that matches the number, order and type
+        /// of the parameters for this constructor.</param>
+        /// <returns>A new instance</returns>
+        /// <remarks>
+        /// If you call a constructor with no parameters, pass null.
+        /// Anyway, what you pass will be ignore.
+        /// </remarks>
+        public object CreateInstance(object[] parameters)
+        {
+            throw new ProbeException(
+                string.Format("Unable to optimize create instance. Cause : Could not find public constructor on the abstract type \"{0}\".", _typeToCreate.Name));
+        }
+
+        #endregion
+    }
+}

Propchange: ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/AbstractFactory.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/AbstractFactory.cs
------------------------------------------------------------------------------
    svn:keywords = Id LastChangedDate LastChangedBy

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/DelegateFactory.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/DelegateFactory.cs?rev=410610&r1=410609&r2=410610&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/DelegateFactory.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/DelegateFactory.cs Wed May 31 10:40:07 2006
@@ -63,7 +63,7 @@
         #endregion
 
         /// <summary>
-        /// Initializes a new instance of the <see cref="T:DelegateObjectFactory"/> class.
+        /// Initializes a new instance of the <see cref="DelegateFactory"/> class.
         /// </summary>
         /// <param name="typeToCreate">The instance type to create.</param>
         /// <param name="argumentTypes">The types argument.</param>

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/DelegateObjectFactory.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/DelegateObjectFactory.cs?rev=410610&r1=410609&r2=410610&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/DelegateObjectFactory.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/DelegateObjectFactory.cs Wed May 31 10:40:07 2006
@@ -26,8 +26,10 @@
 using System;
 using System.Collections;
 using System.Collections.Specialized;
+using System.Reflection;
 using System.Runtime.CompilerServices;
 using System.Text;
+using IBatisNet.Common.Logging;
 
 namespace IBatisNet.Common.Utilities.Objects
 {
@@ -38,14 +40,7 @@
     {
         private IDictionary _cachedfactories = new HybridDictionary();
 		private object _padlock = new object();
-
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="T:DelegateAObjectFactory"/> class.
-        /// </summary>
-        public DelegateObjectFactory()
-		{
-		}
+        private static readonly ILog _logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
 
 		#region IObjectFactory members
         
@@ -68,7 +63,18 @@
 					factory = _cachedfactories[key] as IFactory;
 					if (factory == null) // double-check
 					{
-                        factory = new DelegateFactory(typeToCreate, types);
+                        if (typeToCreate.IsAbstract)
+                        {
+                            if (_logger.IsInfoEnabled)
+                            {
+                                _logger.Info("Create a stub IFactory for abstract type " + typeToCreate.Name);
+                            }
+                            factory = new AbstractFactory(typeToCreate);
+                        }
+					    else
+                        {
+                             factory = new DelegateFactory(typeToCreate, types);
+                        }
 						_cachedfactories[key] = factory;
 					}
 				}

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/EmitObjectFactory.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/EmitObjectFactory.cs?rev=410610&r1=410609&r2=410610&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/EmitObjectFactory.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/EmitObjectFactory.cs Wed May 31 10:40:07 2006
@@ -40,7 +40,7 @@
 		private object _padlock = new object();
         
         /// <summary>
-        /// Initializes a new instance of the <see cref="T:EmitObjectFactory"/> class.
+        /// Initializes a new instance of the <see cref="EmitObjectFactory"/> class.
         /// </summary>
 		public EmitObjectFactory()
 		{

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/FactoryBuilder.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/FactoryBuilder.cs?rev=410610&r1=410609&r2=410610&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/FactoryBuilder.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/FactoryBuilder.cs Wed May 31 10:40:07 2006
@@ -24,10 +24,10 @@
 #endregion
 
 using System;
-using System.Collections;
 using System.Reflection;
 using System.Reflection.Emit;
 using IBatisNet.Common.Exceptions;
+using IBatisNet.Common.Logging;
 
 namespace IBatisNet.Common.Utilities.Objects
 {
@@ -38,7 +38,8 @@
 	{
 		private const BindingFlags VISIBILITY = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
         private const MethodAttributes CREATE_METHOD_ATTRIBUTES = MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.NewSlot | MethodAttributes.Virtual | MethodAttributes.Final;
- 		
+		private static readonly ILog _logger = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType );
+
         private ModuleBuilder _moduleBuilder = null;
        
         /// <summary>
@@ -63,9 +64,20 @@
         /// <returns>Returns a new <see cref="IFactory"/> instance.</returns>
 		public IFactory CreateFactory(Type typeToCreate, Type[] types)
 		{
-			Type innerType = CreateFactoryType(typeToCreate, types);
-			ConstructorInfo ctor = innerType.GetConstructor(Type.EmptyTypes);
-			return (IFactory) ctor.Invoke(new object[] {});
+			if (typeToCreate.IsAbstract)
+			{
+				if (_logger.IsInfoEnabled)
+				{
+                    _logger.Info("Create a stub IFactory for abstract type " + typeToCreate.Name);
+                }
+                return new AbstractFactory(typeToCreate);
+			}
+			else
+			{
+				Type innerType = CreateFactoryType(typeToCreate, types);
+				ConstructorInfo ctor = innerType.GetConstructor(Type.EmptyTypes);
+				return (IFactory) ctor.Invoke(new object[] {});			
+			}
 		}
 
 

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=410610&r1=410609&r2=410610&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 Wed May 31 10:40:07 2006
@@ -611,16 +611,16 @@
     ============================================= -->
 	<parameterMaps>   
 		
-		<parameterMap id="swap-params" class="Hashtable">
+		<parameterMap id="swap-params" >
 			<parameter property="email1" column="First_Email" />
 			<parameter property="email2" column="Second_Email" />
 		</parameterMap>
 		
-		<parameterMap id="select-params" class="Hashtable">
+		<parameterMap id="select-params">
 			<parameter property="Account_ID" />
 		</parameterMap>
 				
-		<parameterMap id="insert-params" class="Account">
+		<parameterMap id="insert-params" >
 			<parameter property="Id" />
 			<parameter property="FirstName" />
 			<parameter property="LastName" />			

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/MSSQL/ProcedureTest.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/MSSQL/ProcedureTest.cs?rev=410610&r1=410609&r2=410610&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/MSSQL/ProcedureTest.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/MSSQL/ProcedureTest.cs Wed May 31 10:40:07 2006
@@ -25,6 +25,7 @@
 			InitScript( sqlMap.DataSource, ScriptDirectory + "category-procedure.sql" );		
 			InitScript( sqlMap.DataSource, ScriptDirectory + "account-init.sql" );	
 			InitScript( sqlMap.DataSource, ScriptDirectory + "account-procedure.sql", false );
+			InitScript( sqlMap.DataSource, ScriptDirectory + "ps_SelectAccount.sql", false );		
 			InitScript( sqlMap.DataSource, ScriptDirectory + "swap-procedure.sql" );	
 		}
 
@@ -39,6 +40,16 @@
 
 		#region Specific statement store procedure tests for sql server
 
+		/// <summary>
+		/// Test get an account via a store procedure.
+		/// </summary>
+		[Test] 
+		public void GetAccountViaProcedure()
+		{
+			Account account = sqlMap.QueryForObject("GetAccountViaSP", 1) as Account;
+			Assert.AreEqual(1, account.Id );
+		}
+		
 		/// <summary>
 		/// Test an insert with identity key via a store procedure.
 		/// </summary>

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/ChangeLog.txt
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/ChangeLog.txt?rev=410610&r1=410609&r2=410610&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/ChangeLog.txt (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/ChangeLog.txt Wed May 31 10:40:07 2006
@@ -14,7 +14,7 @@
 
 Improvements/Changes
 - IBATISNET-156 : Added support for MARS  
-  Added allowMARS attribute on provider tag (used by SqlServer 2005, PostgreSQL).
+				  Added allowMARS attribute on provider tag (used by SqlServer 2005, PostgreSQL).
 - IBATISNET-155 Allow Constructor Initialization on resultMap 
   use
   <resultMap id="account-result-constructor" class="Account" > 
@@ -30,11 +30,11 @@
 
 - IBATISNET-153 Supporting private field accessor
 - IBATISNET-147 : Emitted types for populating and instantiating result  
-  Added useReflectionOptimizer attribut setting in SqlMap.config
+				  Added useReflectionOptimizer attribut setting in SqlMap.config
 - IBATISNET-105 : Added Lazy load support for Strong typed collections
 - Added ISqlMapper interface to simplify mock or stub
 - Added support for readOnly & serialize attribut on CacheModel
-- Added class attribute to parameterMap tags [it is required !]
+- Added class attribute to parameterMap tags [it is recommended !]
 - Added Support for nullable type in .NET V2
 - Added Support for .NET V2 and Generic
 	

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Commands/DefaultPreparedCommand.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Commands/DefaultPreparedCommand.cs?rev=410610&r1=410609&r2=410610&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Commands/DefaultPreparedCommand.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Commands/DefaultPreparedCommand.cs Wed May 31 10:40:07 2006
@@ -85,14 +85,14 @@
 		}
 
 
-		/// <summary>
-		/// 
-		/// </summary>
-		/// <param name="session"></param>
-		/// <param name="command"></param>
-		/// <param name="request"></param>
-		/// <param name="statement"></param>
-		/// <param name="parameterObject"></param>
+        /// <summary>
+        /// Applies the parameter map.
+        /// </summary>
+        /// <param name="session">The session.</param>
+        /// <param name="command">The command.</param>
+        /// <param name="request">The request.</param>
+        /// <param name="statement">The statement.</param>
+        /// <param name="parameterObject">The parameter object.</param>
 		protected virtual void ApplyParameterMap
 			( IDalSession session, IDbCommand command,
 			RequestScope request, IStatement statement, object parameterObject )

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/ParameterMap.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/ParameterMap.cs?rev=410610&r1=410609&r2=410610&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/ParameterMap.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/ParameterMap.cs Wed May 31 10:40:07 2006
@@ -29,8 +29,10 @@
 using System;
 using System.Collections;
 using System.Data;
+using System.Reflection;
 using System.Xml;
 using System.Xml.Serialization;
+using IBatisNet.Common.Logging;
 using IBatisNet.DataMapper.Configuration.Serializers;
 using IBatisNet.DataMapper.DataExchange;
 using IBatisNet.DataMapper.Scope;
@@ -53,6 +55,8 @@
 		private const string XML_PARAMATER = "parameter";
 
 		#region private
+		private static readonly ILog _logger = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType );
+		
 		[NonSerialized]
 		private string _id = string.Empty;
 		[NonSerialized]
@@ -88,8 +92,14 @@
 			get { return _className; }
 			set 
 			{ 
-				if ((value == null) || (value.Length < 1))
-					throw new ArgumentNullException("The class attribute is mandatory in a ParameterMap tag '"+_id+"'.");
+				if (_logger.IsInfoEnabled)
+				{
+					if ((value == null) || (value.Length < 1))
+					{
+						_logger.Info("The class attribute is recommended for better performance in a ParameterMap tag '"+_id+"'.");
+					}					
+				}
+
 
 				_className = value; 
 			}
@@ -318,9 +328,13 @@
 			if (_className.Length>0 )
 			{
                 _parameterClass = _dataExchangeFactory.TypeHandlerFactory.GetType(_className);
+				_dataExchange = _dataExchangeFactory.GetDataExchangeForClass(_parameterClass);
+			}
+			else
+			{
+				// Get the ComplexDataExchange
+				_dataExchange = _dataExchangeFactory.GetDataExchangeForClass(null);
 			}
-
-			_dataExchange = _dataExchangeFactory.GetDataExchangeForClass(_parameterClass);
 		}
 
 

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/ParameterMapDeSerializer.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/ParameterMapDeSerializer.cs?rev=410610&r1=410609&r2=410610&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/ParameterMapDeSerializer.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/ParameterMapDeSerializer.cs Wed May 31 10:40:07 2006
@@ -54,7 +54,7 @@
 
 			parameterMap.ExtendMap = NodeUtils.GetStringAttribute(prop, "extends");
 			parameterMap.Id =  NodeUtils.GetStringAttribute(prop, "id");
-			parameterMap.ClassName = NodeUtils.GetStringAttribute(prop,"class");
+			parameterMap.ClassName = NodeUtils.GetStringAttribute(prop, "class");
 
 			configScope.ErrorContext.MoreInfo = "Initialize ParameterMap";
 			configScope.NodeContext = node;