Author: gbayon
Date: Tue Jun  6 11:29:26 2006
New Revision: 412184

URL: http://svn.apache.org/viewvc?rev=412184&view=rev
Log:
- Fixed Property accessor exception when overriding a property with the new 
keyword as suggested by Nguyen, Tom
- Fixed issue when result property have only set access

Added:
    
ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/ReflectionInfoTest.cs
   (with props)
Modified:
    ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Document.cs
    ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Property.cs
    ibatis/trunk/cs/mapper/IBatisNet.Common.Test/IBatisNet.Common.Test.csproj
    
ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/PropertyAccessorTest.cs
    
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/DelegatePropertyGetAccessor.cs
    
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/DelegatePropertySetAccessor.cs
    
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/EmitPropertyGetAccessor.cs
    
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/EmitPropertySetAccessor.cs
    
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/GetAccessorFactory.cs
    
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/SetAccessorFactory.cs
    ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/ObjectProbe.cs
    ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/ReflectionInfo.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Document.cs
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Document.xml
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Order.xml
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/InheritanceTest.cs
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/MSSQL/ProcedureTest.cs
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/ParameterProperty.cs
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultProperty.cs
    
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/ResultMapDeSerializer.cs
    ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/ConfigurationScope.cs

Modified: 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=412184&r1=412183&r2=412184&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Document.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Document.cs Tue Jun  6 
11:29:26 2006
@@ -8,11 +8,17 @@
        public abstract class Document
        {
                private DateTime _date = DateTime.MinValue;
-               
+               private int _nb = int.MinValue;
+       
                public DateTime Creation
                {
                        get { return _date;}
                        set { _date = value;}
+               }
+               
+               public int PageNumber
+               {
+                       get { return _nb;}
                }
        }
 }

Modified: ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Property.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Property.cs?rev=412184&r1=412183&r2=412184&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Property.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Property.cs Tue Jun  6 
11:29:26 2006
@@ -173,7 +173,7 @@
     public class PropertySon : Property
     {
         private int _int = int.MinValue;
-        private float _float = float.MinValue;
+        private int _float = int.MinValue;
 
         private int PrivateIndex
         {
@@ -208,7 +208,7 @@
             set { throw new InvalidOperationException("Test virtual"); }
         }
 
-        public new float Float
+        public new int Float
         {
             get { return _float; }
             set { _float = value*2; }

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=412184&r1=412183&r2=412184&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 
Tue Jun  6 11:29:26 2006
@@ -340,6 +340,11 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = 
"NUnit\CommonTests\Utilities\ReflectionInfoTest.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "NUnit\CommonTests\Utilities\ResourcesTest.cs"
                     SubType = "Code"
                     BuildAction = "Compile"

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/PropertyAccessorTest.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/PropertyAccessorTest.cs?rev=412184&r1=412183&r2=412184&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/PropertyAccessorTest.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/PropertyAccessorTest.cs
 Tue Jun  6 11:29:26 2006
@@ -215,9 +215,9 @@
             ISetAccessor accessorSet = 
factorySet.CreateSetAccessor(typeof(PropertySon), "Float");
 
             PropertySon son = new PropertySon();
-            accessorSet.Set(son, -99.99f);
+            accessorSet.Set(son, -99);
 
-            Assert.AreEqual(-99.99f*2, son.Float);
+            Assert.AreEqual(-99*2, son.Float);
         }
 
         /// <summary>
@@ -229,9 +229,9 @@
             IGetAccessor accessorGet = 
factoryGet.CreateGetAccessor(typeof(PropertySon), "Float");
 
             PropertySon son = new PropertySon();
-            son.Float = -99.99f;
+            son.Float = -99;
 
-            Assert.AreEqual(-99.99f * 2, accessorGet.Get(son));
+            Assert.AreEqual(-99 * 2, accessorGet.Get(son));
         }
     }
 

Added: 
ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/ReflectionInfoTest.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/ReflectionInfoTest.cs?rev=412184&view=auto
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/ReflectionInfoTest.cs
 (added)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/ReflectionInfoTest.cs
 Tue Jun  6 11:29:26 2006
@@ -0,0 +1,27 @@
+using System;
+using IBatisNet.Common.Utilities.Objects;
+using NUnit.Framework;
+
+
+using IBatisNet.Common.Test.Domain;
+namespace IBatisNet.Common.Test.NUnit.CommonTests.Utilities
+{
+       /// <summary>
+       /// Summary description for ReflectionInfoTest.
+       /// </summary>
+       [TestFixture]
+       public class ReflectionInfoTest
+       {
+               /// <summary>
+               /// Test multiple call to factory
+               /// </summary>
+               [Test]
+               public void TestReflectionInfo()
+               {
+
+                       ReflectionInfo info = ReflectionInfo.GetInstance(typeof 
(Document));
+                       
+                       Type type = info.GetGetterType("PageNumber");
+               }
+       }
+}

Propchange: 
ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/ReflectionInfoTest.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/ReflectionInfoTest.cs
------------------------------------------------------------------------------
    svn:keywords = Id LastChangedDate LastChangedBy

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/DelegatePropertyGetAccessor.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/DelegatePropertyGetAccessor.cs?rev=412184&r1=412183&r2=412184&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/DelegatePropertyGetAccessor.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/DelegatePropertyGetAccessor.cs
 Tue Jun  6 11:29:26 2006
@@ -61,8 +61,14 @@
             _targetType = targetObjectType;
             _propertyName = propertyName;
 
-            PropertyInfo propertyInfo = _targetType.GetProperty(propertyName);
-
+            // deals with Overriding a property using new and reflection
+            // http://blogs.msdn.com/thottams/archive/2006/03/17/553376.aspx
+            PropertyInfo propertyInfo = _targetType.GetProperty(propertyName, 
BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
+            if (propertyInfo == null)
+            {
+                propertyInfo = _targetType.GetProperty(propertyName);
+            }
+            
                        // Make sure the property exists
                        if(propertyInfo == null)
                        {

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/DelegatePropertySetAccessor.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/DelegatePropertySetAccessor.cs?rev=412184&r1=412183&r2=412184&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/DelegatePropertySetAccessor.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/DelegatePropertySetAccessor.cs
 Tue Jun  6 11:29:26 2006
@@ -62,8 +62,14 @@
             _targetType = targetObjectType;
             _propertyName = propertyName;
 
-            PropertyInfo propertyInfo = _targetType.GetProperty(propertyName);
-
+            // deals with Overriding a property using new and reflection
+            // http://blogs.msdn.com/thottams/archive/2006/03/17/553376.aspx
+            PropertyInfo propertyInfo = _targetType.GetProperty(propertyName, 
BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
+            if (propertyInfo == null)
+            {
+                propertyInfo = _targetType.GetProperty(propertyName);
+            }
+                    
                        // Make sure the property exists
                        if(propertyInfo == null)
                        {

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/EmitPropertyGetAccessor.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/EmitPropertyGetAccessor.cs?rev=412184&r1=412183&r2=412184&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/EmitPropertyGetAccessor.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/EmitPropertyGetAccessor.cs
 Tue Jun  6 11:29:26 2006
@@ -66,7 +66,13 @@
                        _targetType = targetObjectType;
                        _propertyName = propertyName;
 
-                       PropertyInfo propertyInfo = 
_targetType.GetProperty(propertyName);
+               // deals with Overriding a property using new and reflection
+               // http://blogs.msdn.com/thottams/archive/2006/03/17/553376.aspx
+                       PropertyInfo propertyInfo = 
_targetType.GetProperty(propertyName, BindingFlags.Public | 
BindingFlags.Instance | BindingFlags.DeclaredOnly);
+                       if (propertyInfo == null)
+                       {
+                               propertyInfo = 
_targetType.GetProperty(propertyName);
+                       }
 
                        // Make sure the property exists
                        if(propertyInfo == null)
@@ -137,7 +143,11 @@
                        if (_canRead)
             {
                 // Emit the IL for get access. 
-                MethodInfo targetGetMethod = _targetType.GetMethod("get_" + 
_propertyName);
+                               MethodInfo targetGetMethod = 
_targetType.GetMethod("get_" + _propertyName, BindingFlags.Public | 
BindingFlags.Instance | BindingFlags.DeclaredOnly);
+                               if (targetGetMethod == null)
+                               {
+                                       targetGetMethod =  
_targetType.GetMethod("get_" + _propertyName);
+                               }                       
 
                 generatorIL.DeclareLocal(typeof(object));
                 generatorIL.Emit(OpCodes.Ldarg_1);     //Load the first 
argument,(target object)

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/EmitPropertySetAccessor.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/EmitPropertySetAccessor.cs?rev=412184&r1=412183&r2=412184&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/EmitPropertySetAccessor.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/EmitPropertySetAccessor.cs
 Tue Jun  6 11:29:26 2006
@@ -67,8 +67,14 @@
                        _targetType = targetObjectType;
                        _propertyName = propertyName;
 
-                       PropertyInfo propertyInfo = 
_targetType.GetProperty(propertyName);
-
+                       // deals with Overriding a property using new and 
reflection
+                       // 
http://blogs.msdn.com/thottams/archive/2006/03/17/553376.aspx
+                       PropertyInfo propertyInfo = 
_targetType.GetProperty(propertyName, BindingFlags.Public | 
BindingFlags.Instance | BindingFlags.DeclaredOnly);
+                       if (propertyInfo == null)
+                       {
+                               propertyInfo = 
_targetType.GetProperty(propertyName);
+                       }
+               
                        // Make sure the property exists
                        if(propertyInfo == null)
                        {
@@ -104,7 +110,7 @@
             if (_emittedSet == null)
             {
                 throw new NotSupportedException(
-                    string.Format("Unable to create a get propert accessor for 
'{0}' property on class  '{0}'.", _propertyName, _propertyType));
+                    string.Format("Unable to create a get propert accessor for 
'{0}' property on class  '{1}'.", _propertyName, _propertyType.ToString()));
             }
         }
 
@@ -137,16 +143,17 @@
                 null,
                 setParamTypes);
 
-            // Get an ILGenerator and used it to emit the IL that we want.
-            ILGenerator generatorIL = methodBuilder.GetILGenerator();
-
                        // Get an ILGenerator and  used to emit the IL that we 
want.
                        // Set(object, value);
-                       generatorIL = methodBuilder.GetILGenerator();
+                       ILGenerator generatorIL = 
methodBuilder.GetILGenerator();
                        if (_canWrite)
             {
                 // Emit the IL for the set access. 
-                MethodInfo targetSetMethod = _targetType.GetMethod("set_" + 
_propertyName);
+                               MethodInfo targetSetMethod = 
_targetType.GetMethod("set_" + _propertyName,BindingFlags.Public | 
BindingFlags.Instance | BindingFlags.DeclaredOnly);
+                               if (targetSetMethod == null)
+                               {
+                                       targetSetMethod =  
_targetType.GetMethod("set_" + _propertyName);
+                               }
                 Type paramType = 
targetSetMethod.GetParameters()[0].ParameterType;
 
                 generatorIL.DeclareLocal(paramType);

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/GetAccessorFactory.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/GetAccessorFactory.cs?rev=412184&r1=412183&r2=412184&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/GetAccessorFactory.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/GetAccessorFactory.cs
 Tue Jun  6 11:29:26 2006
@@ -164,7 +164,11 @@
 #if dotnet2
                 methodInfo = propertyInfo.GetSetMethod();
 #else
-                methodInfo = targetType.GetMethod("get_" + propertyName);
+                               methodInfo = targetType.GetMethod("get_" + 
propertyName,BindingFlags.Public | BindingFlags.Instance | 
BindingFlags.DeclaredOnly);
+                               if (methodInfo == null)
+                               {
+                                       methodInfo =  
targetType.GetMethod("get_" + propertyName);
+                               }
 #endif
                 if (methodInfo != null)// == visibilty public
                 {

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/SetAccessorFactory.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/SetAccessorFactory.cs?rev=412184&r1=412183&r2=412184&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/SetAccessorFactory.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/SetAccessorFactory.cs
 Tue Jun  6 11:29:26 2006
@@ -163,7 +163,11 @@
 #if dotnet2
                 methodInfo = propertyInfo.GetSetMethod();
 #else
-                methodInfo = targetType.GetMethod("set_" + propertyName);
+                methodInfo = targetType.GetMethod("set_" + 
propertyName,BindingFlags.Public | BindingFlags.Instance | 
BindingFlags.DeclaredOnly);
+                               if (methodInfo == null)
+                               {
+                                       methodInfo =  
targetType.GetMethod("set_" + propertyName);
+                               }
 #endif
                 if (methodInfo != null)// == visibilty public
                 {

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/ObjectProbe.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/ObjectProbe.cs?rev=412184&r1=412183&r2=412184&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/ObjectProbe.cs 
(original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/ObjectProbe.cs 
Tue Jun  6 11:29:26 2006
@@ -142,6 +142,35 @@
 
 
                /// <summary>
+               ///  Returns the type that the set expects to receive as a 
parameter when
+               ///  setting a member value.
+               /// </summary>
+               /// <param name="type">The class type to check</param>
+               /// <param name="memberName">The name of the member</param>
+               /// <returns>The type of the member</returns>
+               public static Type GetMemberTypeForSetter(Type type, string 
memberName) 
+               {
+                       Type memberType = type;
+                       if (memberName.IndexOf('.') > -1) 
+                       {
+                               StringTokenizer parser = new 
StringTokenizer(memberName, ".");
+                               IEnumerator enumerator = parser.GetEnumerator();
+
+                               while (enumerator.MoveNext()) 
+                               {
+                                       memberName = (string)enumerator.Current;
+                                       memberType = 
ReflectionInfo.GetInstance(memberType).GetSetterType(memberName);
+                               }
+                       } 
+                       else 
+                       {
+                               memberType = 
ReflectionInfo.GetInstance(type).GetSetterType(memberName);
+                       }
+
+                       return memberType;
+               }
+
+               /// <summary>
                ///  Returns the type that the get expects to receive as a 
parameter when
                ///  setting a member value.
                /// </summary>

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/ReflectionInfo.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/ReflectionInfo.cs?rev=412184&r1=412183&r2=412184&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/ReflectionInfo.cs 
(original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/ReflectionInfo.cs 
Tue Jun  6 11:29:26 2006
@@ -234,7 +234,7 @@
                        Type type = (Type) _getTypes[memberName];
                        if (type == null) 
                        {
-                               throw new ProbeException("There is no Get 
mmeber named '" + memberName + "' in class '" + _className + "'");
+                               throw new ProbeException("There is no Get 
member named '" + memberName + "' in class '" + _className + "'");
                        }
                        return type;
                }

Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Document.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Document.cs?rev=412184&r1=412183&r2=412184&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Document.cs 
(original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Domain/Document.cs Tue Jun 
 6 11:29:26 2006
@@ -19,5 +19,11 @@
                        get { return _title; }
                        set { _title = value; }
                }
+               
+               public string Test
+               {
+                       set { _title = value; }
+               }
+               
        }
 }

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Account.xml?rev=412184&r1=412183&r2=412184&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
 Tue Jun  6 11:29:26 2006
@@ -600,10 +600,18 @@
                        ps_swap_email_address
                </procedure>
 
-               <procedure id="GetAccountViaSP" parameterMap="select-params" 
resultClass="Account">
+               <procedure id="GetAccountViaSP0" parameterMap="select-params0" 
resultClass="Account">
                        ps_SelectAccount
                </procedure>
                
+               <procedure id="GetAccountViaSP1" parameterMap="select-params1" 
resultClass="Account">
+                       ps_SelectAccount
+               </procedure>
+       
+               <procedure id="GetAccountViaSP2" parameterMap="select-params2" 
resultClass="Account">
+                       ps_SelectAccount
+               </procedure>
+                       
        </statements>
 
        <!-- =============================================
@@ -616,10 +624,18 @@
                        <parameter property="email2" column="Second_Email" />
                </parameterMap>
                
-               <parameterMap id="select-params">
-                       <parameter property="Account_ID" />
+               <parameterMap id="select-params0">
+                       <parameter property="Account_ID" column="Account_ID" />
+               </parameterMap>
+                       
+               <parameterMap id="select-params1" class="int">
+                       <parameter property="Account_ID" column="Account_ID" />
+               </parameterMap>
+
+               <parameterMap id="select-params2" class="Hashtable">
+                       <parameter property="Account_ID" column="Account_ID" />
                </parameterMap>
-                               
+                                                               
                <parameterMap id="insert-params" >
                        <parameter property="Id" />
                        <parameter property="FirstName" />

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Document.xml
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Document.xml?rev=412184&r1=412183&r2=412184&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Document.xml
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Document.xml
 Tue Jun  6 11:29:26 2006
@@ -15,6 +15,7 @@
                <resultMap id="document" class="Document">
                        <result property="Id"                   
column="Document_ID"/>
                        <result property="Title"                
column="Document_Title"/>
+                       <result property="Test"                 
column="Document_Title"/>
                        <discriminator column="Document_Type" type="string"/> 
                        <subMap value="Book" resultMapping="book" />
                        <subMap value="Newspaper" resultMapping="newspaper" />

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Order.xml
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Order.xml?rev=412184&r1=412183&r2=412184&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Order.xml 
(original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Order.xml 
Tue Jun  6 11:29:26 2006
@@ -267,7 +267,7 @@
                        <result property="City"       column="Order_City"/>
                        <result property="Province"   column="Order_Province"/>
                        <result property="PostalCode" 
column="Order_PostalCode"/>
-                       <result property="Account"    
column="Account_ID=Account_ID" select="GetAccountViaSP" />
+                       <result property="Account"    
column="Account_ID=Account_ID" select="GetAccountViaSP0" />
                </resultMap>
                
                <resultMap id="order-with-collection-result" class="Order">

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/InheritanceTest.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/InheritanceTest.cs?rev=412184&r1=412183&r2=412184&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/InheritanceTest.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/InheritanceTest.cs
 Tue Jun  6 11:29:26 2006
@@ -89,16 +89,16 @@
                        book = (Book) list[1];
                        AssertBook(book, 3, "Lord of the Rings", 3587);
 
-                       Document document = (Document) list[2];
+                       Document document = list[2];
                        AssertDocument(document, 5, "Le Monde");
 
-                       document = (Document) list[3];
+                       document = list[3];
                        AssertDocument(document, 6, "Foundation");
 
                        Newspaper news = (Newspaper) list[4];
                        AssertNewspaper(news, 2, "Le Progres de Lyon", "Lyon");
 
-                       document = (Document) list[5];
+                       document = list[5];
                        AssertDocument(document, 4, "Le Canard enchaine");
                }
 

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=412184&r1=412183&r2=412184&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
 Tue Jun  6 11:29:26 2006
@@ -44,9 +44,31 @@
                /// Test get an account via a store procedure.
                /// </summary>
                [Test] 
-               public void GetAccountViaProcedure()
+               public void GetAccountViaProcedure0()
                {
-                       Account account = 
sqlMap.QueryForObject("GetAccountViaSP", 1) as Account;
+                       Account account = 
sqlMap.QueryForObject("GetAccountViaSP0", 1) as Account;
+                       Assert.AreEqual(1, account.Id );
+               }
+               
+               /// <summary>
+               /// Test get an account via a store procedure.
+               /// </summary>
+               [Test] 
+               public void GetAccountViaProcedure1()
+               {
+                       Account account = 
sqlMap.QueryForObject("GetAccountViaSP1", 1) as Account;
+                       Assert.AreEqual(1, account.Id );
+               }
+               
+               /// <summary>
+               /// Test get an account via a store procedure.
+               /// </summary>
+               [Test] 
+               public void GetAccountViaProcedure2()
+               {
+                       Hashtable hash = new Hashtable();
+                       hash.Add("Account_ID",1);
+                       Account account = 
sqlMap.QueryForObject("GetAccountViaSP2", hash) as Account;
                        Assert.AreEqual(1, account.Id );
                }
                

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/ParameterProperty.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/ParameterProperty.cs?rev=412184&r1=412183&r2=412184&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/ParameterProperty.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/ParameterProperty.cs
 Tue Jun  6 11:29:26 2006
@@ -284,6 +284,7 @@
         /// <param name="parameterClass">The parameter class.</param>
                public void Initialize(IScope scope, Type parameterClass)
                {
+
                        if(_directionAttribute.Length >0)
                        {
                                _direction = (ParameterDirection)Enum.Parse( 
typeof(ParameterDirection), _directionAttribute, true );
@@ -326,7 +327,15 @@
                        {
                                if (this.CLRType.Length == 0 )  // Unknown
                                {
-                    _typeHandler = 
scope.DataExchangeFactory.TypeHandlerFactory.GetUnkownTypeHandler();
+                                       if 
(scope.DataExchangeFactory.TypeHandlerFactory.IsSimpleType(parameterClass)) 
+                                       {
+                                               // Primitive
+                                               _typeHandler = 
scope.DataExchangeFactory.TypeHandlerFactory.GetTypeHandler(parameterClass, 
_dbType);
+                                       }
+                                       else
+                                       {
+                           _typeHandler = 
scope.DataExchangeFactory.TypeHandlerFactory.GetUnkownTypeHandler();
+                                       }
                                }
                                else // If we specify a CLR type, use it
                                {

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultProperty.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultProperty.cs?rev=412184&r1=412183&r2=412184&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultProperty.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultProperty.cs
 Tue Jun  6 11:29:26 2006
@@ -359,7 +359,7 @@
                        else
                        {
                                configScope.ErrorContext.MoreInfo = "Result 
property '"+_propertyName+"' set the typeHandler attribute.";
-                               _typeHandler = configScope.ResolveTypeHandler( 
resultClass, _propertyName, _clrType, _dbType);
+                               _typeHandler = configScope.ResolveTypeHandler( 
resultClass, _propertyName, _clrType, _dbType, true);
                        }
 
             if (this.IsLazyLoad)

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/ResultMapDeSerializer.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/ResultMapDeSerializer.cs?rev=412184&r1=412183&r2=412184&view=diff
==============================================================================
--- 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/ResultMapDeSerializer.cs
 (original)
+++ 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/ResultMapDeSerializer.cs
 Tue Jun  6 11:29:26 2006
@@ -25,6 +25,7 @@
 
 #region Using
 
+using System;
 using System.Collections.Specialized;
 using System.Xml;
 using IBatisNet.Common.Xml;

Modified: 
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/ConfigurationScope.cs
URL: 
http://svn.apache.org/viewvc/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/ConfigurationScope.cs?rev=412184&r1=412183&r2=412184&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/ConfigurationScope.cs 
(original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/ConfigurationScope.cs Tue 
Jun  6 11:29:26 2006
@@ -259,15 +259,17 @@
 
                #endregion 
 
-               /// <summary>
-               /// 
-               /// </summary>
-               /// <param name="clazz">Type of the ResultMap</param>
-               /// <param name="propertyName">Property name to map</param>
-               /// <param name="clrType"></param>
-               /// <param name="dbType"></param>
-               /// <returns></returns>
-               public ITypeHandler ResolveTypeHandler(Type clazz, string 
propertyName, string clrType, string dbType)
+
+        /// <summary>
+        /// Resolves the type handler.
+        /// </summary>
+        /// <param name="clazz">The clazz.</param>
+        /// <param name="memberName">Name of the member.</param>
+        /// <param name="clrType">Type of the CLR.</param>
+        /// <param name="dbType">Type of the db.</param>
+        /// <param name="forSetter">if set to <c>true</c> [for setter].</param>
+        /// <returns></returns>
+               public ITypeHandler ResolveTypeHandler(Type clazz, string 
memberName, string clrType, string dbType, bool forSetter)
                {
                        ITypeHandler handler = null;
                        if (clazz==null)
@@ -308,7 +310,15 @@
                                // .NET object
                                if (clrType ==null || clrType.Length == 0) 
                                {
-                                       Type type = 
ObjectProbe.GetMemberTypeForGetter(clazz, propertyName);
+                                       Type type = null;
+                                       if (forSetter)
+                                       {
+                                               type = 
ObjectProbe.GetMemberTypeForSetter(clazz, memberName);
+                                       }
+                                       else
+                                       {
+                                               type = 
ObjectProbe.GetMemberTypeForGetter(clazz, memberName);   
+                                       }
                     handler = 
this.DataExchangeFactory.TypeHandlerFactory.GetTypeHandler(type, dbType);
                                } 
                                else 


Reply via email to