Author: gbayon
Date: Sun Apr 30 01:41:07 2006
New Revision: 398296
URL: http://svn.apache.org/viewcvs?rev=398296&view=rev
Log:
- Updated for VS 2005 + cosmetic change
Removed:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/LazyLoadList.cs
Modified:
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/ReflectionPropertyAccessor.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ArgumentProperty.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultProperty.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/DataExchange/DataExchangeFactory.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.csproj
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Proxy/LazyLoadProxyFactory.cs
Modified:
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/ReflectionPropertyAccessor.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/ReflectionPropertyAccessor.cs?rev=398296&r1=398295&r2=398296&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/ReflectionPropertyAccessor.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/ReflectionPropertyAccessor.cs
Sun Apr 30 01:41:07 2006
@@ -34,17 +34,13 @@
/// </summary>
public class ReflectionPropertyAccessor : IMemberAccessor,
IPropertyAccessor
{
- // private static BindingFlags BINDING_FLAGS
- // = BindingFlags.Public
- // | BindingFlags.Instance
- // ;
-
private PropertyInfo _propertyInfo = null;
private string _propertyName = string.Empty;
private Type _targetType = null;
/// <summary>
/// Creates a new Reflection property accessor.
+ /// Generates the implementation for getter and setter methods.
/// </summary>
/// <param name="targetType">Target object type.</param>
/// <param name="propertyName">Property name.</param>
@@ -53,7 +49,6 @@
ReflectionInfo reflectionCache =
ReflectionInfo.GetInstance( targetType );
_propertyInfo =
(PropertyInfo)reflectionCache.GetGetter(propertyName);
- //_propertyInfo =
(PropertyInfo)ObjectProbe.GetPropertyInfoForSetter(targetType, propertyName);
_targetType = targetType;
_propertyName = propertyName;
}
@@ -108,15 +103,14 @@
}
else
{
- throw new MissingMethodException(
+ throw new NotSupportedException(
string.Format("Property \"{0}\" on type
"
+ "{1} doesn't have a get method.",
_propertyName, _targetType));
}
}
/// <summary>
- /// Sets the value for the property of
- /// the specified target.
+ /// Sets the value for the property of the specified target.
/// </summary>
/// <param name="target">Object to set the property on.</param>
/// <param name="value">Property value.</param>
@@ -128,7 +122,7 @@
}
else
{
- throw new MissingMethodException(
+ throw new NotSupportedException(
string.Format("Property \"{0}\" on type
"
+ "{1} doesn't have a set method.",
_propertyName, _targetType));
}
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs?rev=398296&r1=398295&r2=398296&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
Sun Apr 30 01:41:07 2006
@@ -294,6 +294,7 @@
#endregion
+ #region Properties
/// <summary>
/// Allow to set a custom member accessor factory, see <see
cref="IMemberAccessorFactory"/>
/// </summary>
@@ -317,6 +318,7 @@
{
set { _validateSqlMapConfig = value; }
}
+ #endregion
#region Constructor
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ArgumentProperty.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ArgumentProperty.cs?rev=398296&r1=398295&r2=398296&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ArgumentProperty.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ArgumentProperty.cs
Sun Apr 30 01:41:07 2006
@@ -80,6 +80,16 @@
}
/// <summary>
+ /// Tell us if we must lazy load this property..
+ /// </summary>
+ [XmlAttribute("lazyLoad")]
+ public override bool IsLazyLoad
+ {
+ get { return false; }
+ set { throw new InvalidOperationException("Argument
property cannot be lazy load."); }
+ }
+
+ /// <summary>
/// Get the argument type
/// </summary>
[XmlIgnore]
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultProperty.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultProperty.cs?rev=398296&r1=398295&r2=398296&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultProperty.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultProperty.cs
Sun Apr 30 01:41:07 2006
@@ -105,7 +105,7 @@
/// Tell us if we must lazy load this property..
/// </summary>
[XmlAttribute("lazyLoad")]
- public bool IsLazyLoad
+ public virtual bool IsLazyLoad
{
get { return _isLazyLoad; }
set { _isLazyLoad = value; }
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/DataExchange/DataExchangeFactory.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/DataExchange/DataExchangeFactory.cs?rev=398296&r1=398295&r2=398296&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/DataExchange/DataExchangeFactory.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/DataExchange/DataExchangeFactory.cs
Sun Apr 30 01:41:07 2006
@@ -125,6 +125,13 @@
}
#if dotnet2
+ /// <summary>
+ /// Determines whether [is implement generic Ilist interface] [the
specified type].
+ /// </summary>
+ /// <param name="type">The type.</param>
+ /// <returns>
+ /// <c>true</c> if [is implement generic I list interface] [the
specified type]; otherwise, <c>false</c>.
+ /// </returns>
public bool IsImplementGenericIListInterface(Type type)
{
Type[] interfaceTypes = type.GetInterfaces();
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj?rev=398296&r1=398295&r2=398296&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.20005.csproj
Sun Apr 30 01:41:07 2006
@@ -466,9 +466,6 @@
<Compile Include="ExecuteEventArgs.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="LazyLoadList.cs">
- <SubType>Code</SubType>
- </Compile>
<Compile Include="MappedStatements\CachingStatement.cs">
<SubType>Code</SubType>
</Compile>
@@ -496,6 +493,8 @@
<Compile Include="Mapper.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="Proxy\LazyLoadInterceptor.cs" />
+ <Compile Include="Proxy\LazyLoadProxyFactory.cs" />
<Compile Include="Scope\ConfigurationScope.cs">
<SubType>Code</SubType>
</Compile>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.csproj
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.csproj?rev=398296&r1=398295&r2=398296&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.csproj
(original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/IBatisNet.DataMapper.csproj Sun
Apr 30 01:41:07 2006
@@ -128,11 +128,6 @@
BuildAction = "None"
/>
<File
- RelPath = "LazyLoadList.cs"
- SubType = "Code"
- BuildAction = "Compile"
- />
- <File
RelPath = "licence.txt"
BuildAction = "Content"
/>
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Proxy/LazyLoadProxyFactory.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Proxy/LazyLoadProxyFactory.cs?rev=398296&r1=398295&r2=398296&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Proxy/LazyLoadProxyFactory.cs
(original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Proxy/LazyLoadProxyFactory.cs
Sun Apr 30 01:41:07 2006
@@ -36,7 +36,7 @@
namespace IBatisNet.DataMapper.Proxy
{
/// <summary>
- /// This class is responsible of create all lazy load proxies.
+ /// This class is responsible of create all <see cref="IList"/> lazy
load proxies.
/// </summary>
public class LazyLoadProxyFactory
{
@@ -67,7 +67,7 @@
object proxy = null;
Type typeProxified = memberAccessor.MemberType;
- bool isIList =
typeof(IList).IsAssignableFrom(memberAccessor.MemberType);
+ bool isIList =
typeof(IList).IsAssignableFrom(memberAccessor.MemberType) ||
memberAccessor.MemberType.IsSubclassOf(typeof(IList));
Type returnedTypeByStatement =
LazyLoadProxyFactory.GetTypeReturnedByStatemet(mappedStatement, isIList);
//Test if the result of the lazy load is assigable to
property, test now load time instead
@@ -95,20 +95,9 @@
proxy =
ProxyGeneratorFactory.GetProxyGenerator().CreateClassProxy(typeProxified,
handler, Type.EmptyTypes);
}
}
- else if (typeProxified.IsClass)
- {
- if (_logger.IsDebugEnabled)
- {
- _logger.Debug(string.Format("Statement
'{0}', create class proxy for member {1}.", mappedStatement.Id
,memberAccessor.MemberType));
- }
-
- //TODO test if param fit with constructor
arguments
- proxy =
ProxyGeneratorFactory.GetProxyGenerator().CreateClassProxy(typeProxified,
handler,
-
LazyLoadProxyFactory.CreateArgumentsForConstructor(typeProxified, param));
- }
else
{
- throw new
DataMapperException(string.Format("Not implemented: the type ({0}) of property
to proxify is not and interface or class.", typeProxified) );
+ throw new
DataMapperException(string.Format("Only proxy on IList type are supported, the
member type ({0}) cannot be proxyfied.", typeProxified) );
}
return proxy;
@@ -160,40 +149,7 @@
}
- /// <summary>
- /// Creates the arguments for constructor.
- /// </summary>
- /// <param name="type">The object type.</param>
- /// <param name="lazyLoadParam">The lazy load param.</param>
- /// <returns>A list of objects argument</returns>
- private static object[] CreateArgumentsForConstructor(Type
type,object lazyLoadParam)
- {
- object[] argumentsForConstructor = null;
- if (type.GetInterface(typeof(ICollection).FullName) !=
null)
- {
- //the collection build whitout arguments
- argumentsForConstructor = new object[]{};
- }
- else
- {
- if (lazyLoadParam == null)
- {
- argumentsForConstructor = new
object[]{};
- }
- if (lazyLoadParam is object[])
- {
- //Multiple primary key
- argumentsForConstructor =
(object[])lazyLoadParam;
- }
- else
- {
- argumentsForConstructor = new
object[]{lazyLoadParam};
- }
- }
-
- return argumentsForConstructor;
- }
}