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/08 15:22:15 UTC
svn commit: r405046 [1/7] - in /ibatis/trunk/cs/mapper:
IBatisNet.Common.Test/Domain/
IBatisNet.Common.Test/NUnit/CommonTests/Utilities/ IBatisNet.Common/
IBatisNet.Common/Utilities/Objects/
IBatisNet.Common/Utilities/Objects/Members/ IBatisNet.DataAcc...
Author: gbayon
Date: Mon May 8 06:21:44 2006
New Revision: 405046
URL: http://svn.apache.org/viewcvs?rev=405046&view=rev
Log:
- Refactoring to improve design and performance
Added:
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/AccessorFactory.cs
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/DelegateGetFieldAccessor.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/DelegateSetFieldAccessor.cs
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/EmitFieldGetAccessor.cs
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/EmitFieldSetAccessor.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/IAccessor.cs
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/IGet.cs
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/IGetAccessor.cs
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/IGetAccessorFactory.cs
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/ISet.cs
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/ISetAccessor.cs
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/ISetAccessorFactory.cs
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/ISetGet.cs
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/ReflectionFieldGetAccessor.cs
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/ReflectionFieldSetAccessor.cs
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/ReflectionPropertyGetAccessor.cs
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/ReflectionPropertySetAccessor.cs
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/SetAccessorFactory.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/ArgumentStrategyFactory.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/DefaultStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/IArgumentStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/ResultMapStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectArrayStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectGenericListStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectListStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectObjectStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ArgumentStrategy/SelectStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/BaseStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PostBindind.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PostSelectStrategy/
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PostSelectStrategy/ArrayStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PostSelectStrategy/GenericListStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PostSelectStrategy/IPostSelectStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PostSelectStrategy/ListStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PostSelectStrategy/ObjectStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PostSelectStrategy/PostSelectStrategyFactory.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PostSelectStrategy/StrongTypedListStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/BaseSelectStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/DefaultStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/IPropertyStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/PropertyStrategyFactory.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/ResultMapStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectArrayStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectGenericListStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectListStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectObjectStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/PropertStrategy/SelectStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ReaderAutoMapper.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/AutoMapStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/BaseResultStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/DictionaryStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/IResultStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/ListStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/ObjectStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/ResultClassStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/ResultMapStrategy.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/ResultStrategyFactory.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/ResultStrategy/SimpleTypeStrategy.cs
Modified:
ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Account.cs
ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Property.cs
ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/BaseMemberTest.cs
ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/FieldAccessorTest.cs
ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/PropertyAccessorPerformance.cs
ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/PropertyAccessorTest.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/DelegateAObjectFactory.cs
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/BaseAccessor.cs
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/BaseEmitAccessor.cs
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/EmitFieldAccessor.cs
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/EmitPropertyAccessor.cs
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/IMemberAccessor.cs
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/MemberAccessorFactory.cs
ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/ReflectionPropertyAccessor.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.DataAccess.Test/IBatisNet.DataAccess.Test.2005.csproj
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/Maps/MSSQL/SqlClient/Order.xml
ibatis/trunk/cs/mapper/IBatisNet.DataMapper.Test/NUnit/SqlMapTests/Generics/ResultMapTest.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Commands/DefaultPreparedCommand.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/InlineParameterMapParser.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/ParameterMap.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/ParameterProperty.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ArgumentProperty.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/Discriminator.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultProperty.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/DynamicDeSerializer.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/IsEmptyDeSerializer.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/IsEqualDeSerializer.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/IsGreaterEqualDeSerializer.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/IsGreaterThanDeSerializer.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/IsLessEqualDeSerializer.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/IsLessThanDeSerializer.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/IsNotEmptyDeSerializer.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/IsNotEqualDeSerializer.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/IsNotNullDeSerializer.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/IsNotParameterPresentDeSerializer.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/IsNotPropertyAvailableDeSerializer.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/IsNullDeSerializer.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/IsParameterPresentDeSerializer.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/IsPropertyAvailableDeSerializer.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/IterateSerializer.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/TypeHandlerDeSerializer.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/DynamicSql.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Elements/Dynamic.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Elements/IsEmpty.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Elements/IsEqual.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Elements/IsGreaterEqual.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Elements/IsGreaterThan.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Elements/IsLessEqual.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Elements/IsLessThan.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Elements/IsNotEmpty.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Elements/IsNotEqual.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Elements/IsNotNull.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Elements/IsNotParameterPresent.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Elements/IsNotPropertyAvailable.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Elements/IsNull.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Elements/IsParameterPresent.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Elements/IsPropertyAvailable.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Elements/Iterate.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Handlers/BaseTagHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Handlers/ConditionalTagHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Handlers/DynamicTagHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Handlers/IsEmptyTagHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Handlers/IsEqualTagHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Handlers/IsGreaterEqualTagHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Handlers/IsGreaterThanTagHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Handlers/IsLessEqualTagHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Handlers/IsLessThanTagHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Handlers/IsNotEmptyTagHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Handlers/IsNotEqualTagHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Handlers/IsNotNullTagHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Handlers/IsNotParameterPresentTagHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Handlers/IsNotPropertyAvailableTagHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Handlers/IsNullTagHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Handlers/IsParameterPresentTagHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Handlers/IsPropertyAvailableTagHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/Handlers/IterateTagHandler.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/ISql.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/SimpleDynamic/SimpleDynamicSql.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Static/ProcedureSql.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Static/StaticSql.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements/IStatement.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements/PreparedStatementFactory.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements/Statement.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/DataExchange/ComplexDataExchange.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/DataExchange/DataExchangeFactory.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/DataExchange/DictionaryDataExchange.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/DataExchange/DotNetObjectDataExchange.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/DataExchange/ListDataExchange.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/DataExchange/PrimitiveDataExchange.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/MappedStatements/CachingStatement.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/IMappedStatement.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/MappedStatements/MappedStatement.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Proxy/LazyLoadInterceptor.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Proxy/LazyLoadProxyFactory.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/ConfigurationScope.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/IScope.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Scope/RequestScope.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs
Modified: ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Account.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Account.cs?rev=405046&r1=405045&r2=405046&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Account.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Account.cs Mon May 8 06:21:44 2006
@@ -3,7 +3,7 @@
namespace IBatisNet.Common.Test.Domain
{
/// <summary>
- /// Description résumée de Account.
+ /// Account.
/// </summary>
[Serializable]
public class Account
Modified: ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Property.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Property.cs?rev=405046&r1=405045&r2=405046&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Property.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common.Test/Domain/Property.cs Mon May 8 06:21:44 2006
@@ -39,7 +39,6 @@
private TimeSpan _timeSpan = TimeSpan.MinValue;
private Account _account = null;
private Days _day;
- private Type _type = null;
#if dotnet2
private Int32? _intNullable = null;
@@ -53,7 +52,6 @@
public Property()
{
- _type = typeof(int);
}
public Days Day
@@ -68,13 +66,13 @@
set { _string = value; }
}
- public int Int
+ public virtual int Int
{
get { return _int; }
set { _int = value; }
}
- public DateTime DateTime
+ public virtual DateTime DateTime
{
get { return _dateTime; }
set { _dateTime = value; }
@@ -140,7 +138,7 @@
set { _bool = value; }
}
- public double Double
+ public virtual double Double
{
get { return _double; }
set { _double = value; }
@@ -158,16 +156,55 @@
set { _guid = value; }
}
- public TimeSpan TimeSpan
+ public virtual TimeSpan TimeSpan
{
get { return _timeSpan; }
set { _timeSpan = value; }
}
- public Account Account
+ public virtual Account Account
{
get { return _account; }
set { _account = value; }
}
}
+
+
+ public class PropertySon : Property
+ {
+ private int _int = int.MinValue;
+
+ private int PrivateIndex
+ {
+ set { _int = value; }
+ }
+
+ public int Index
+ {
+ get { return _int; }
+#if dotnet2
+ protected set { _int = value; }
+#else
+ set { _int = value; }
+#endif
+ }
+
+ public override Account Account
+ {
+ get { return new Account(Days.Wed); }
+ set { throw new InvalidOperationException("Test virtual"); }
+ }
+
+ public override int Int
+ {
+ get { return -88; }
+ set { throw new InvalidOperationException("Test virtual"); }
+ }
+
+ public override DateTime DateTime
+ {
+ get { return new DateTime(2000,1,1); }
+ set { throw new InvalidOperationException("Test virtual"); }
+ }
+ }
}
Modified: ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/BaseMemberTest.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/BaseMemberTest.cs?rev=405046&r1=405045&r2=405046&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/BaseMemberTest.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/BaseMemberTest.cs Mon May 8 06:21:44 2006
@@ -13,28 +13,68 @@
[TestFixture]
public abstract class BaseMemberTest
{
- protected IMemberAccessorFactory factory = null;
- protected IMemberAccessor intAccessor = null;
- protected IMemberAccessor longAccessor = null;
- protected IMemberAccessor sbyteAccessor = null;
- protected IMemberAccessor datetimeAccessor = null;
- protected IMemberAccessor decimalAccessor = null;
- protected IMemberAccessor byteAccessor = null;
- protected IMemberAccessor stringAccessor = null;
- protected IMemberAccessor charAccessor = null;
- protected IMemberAccessor shortAccessor = null;
- protected IMemberAccessor ushortAccessor = null;
- protected IMemberAccessor uintAccessor = null;
- protected IMemberAccessor ulongAccessor = null;
- protected IMemberAccessor boolAccessor = null;
- protected IMemberAccessor doubleAccessor = null;
- protected IMemberAccessor floatAccessor = null;
- protected IMemberAccessor guidAccessor = null;
- protected IMemberAccessor timespanAccessor = null;
- protected IMemberAccessor accountAccessor = null;
- protected IMemberAccessor enumAccessor = null;
+ protected ISetAccessorFactory factorySet = null;
+ protected IGetAccessorFactory factoryGet = null;
+
+ protected ISetAccessor intSetAccessor = null;
+ protected IGetAccessor intGetAccessor = null;
+
+ protected ISetAccessor longSetAccessor = null;
+ protected IGetAccessor longGetAccessor = null;
+
+ protected ISetAccessor sbyteSetAccessor = null;
+ protected IGetAccessor sbyteGetAccessor = null;
+
+ protected ISetAccessor datetimeSetAccessor = null;
+ protected IGetAccessor datetimeGetAccessor = null;
+
+ protected ISetAccessor decimalSetAccessor = null;
+ protected IGetAccessor decimalGetAccessor = null;
+
+ protected ISetAccessor byteSetAccessor = null;
+ protected IGetAccessor byteGetAccessor = null;
+
+ protected ISetAccessor stringSetAccessor = null;
+ protected IGetAccessor stringGetAccessor = null;
+
+ protected ISetAccessor charSetAccessor = null;
+ protected IGetAccessor charGetAccessor = null;
+
+ protected ISetAccessor shortSetAccessor = null;
+ protected IGetAccessor shortGetAccessor = null;
+
+ protected ISetAccessor ushortSetAccessor = null;
+ protected IGetAccessor ushortGetAccessor = null;
+
+ protected ISetAccessor uintSetAccessor = null;
+ protected IGetAccessor uintGetAccessor = null;
+
+ protected ISetAccessor ulongSetAccessor = null;
+ protected IGetAccessor ulongGetAccessor = null;
+
+ protected ISetAccessor boolSetAccessor = null;
+ protected IGetAccessor boolGetAccessor = null;
+
+ protected ISetAccessor doubleSetAccessor = null;
+ protected IGetAccessor doubleGetAccessor = null;
+
+ protected ISetAccessor floatSetAccessor = null;
+ protected IGetAccessor floatGetAccessor = null;
+
+ protected ISetAccessor guidSetAccessor = null;
+ protected IGetAccessor guidGetAccessor = null;
+
+ protected ISetAccessor timespanSetAccessor = null;
+ protected IGetAccessor timespanGetAccessor = null;
+
+ protected ISetAccessor accountSetAccessor = null;
+ protected IGetAccessor accountGetAccessor = null;
+
+ protected ISetAccessor enumSetAccessor = null;
+ protected IGetAccessor enumGetAccessor = null;
#if dotnet2
- protected IMemberAccessor nullableAccessor = null;
+ protected ISetAccessor nullableSetAccessor = null;
+ protected IGetAccessor nullableGetAccessor = null;
#endif
@@ -44,7 +84,8 @@
[TestFixtureSetUp]
protected virtual void SetUpFixture()
{
- factory = new MemberAccessorFactory(true);
+ factoryGet = new GetAccessorFactory(true);
+ factorySet = new SetAccessorFactory(true);
}
/// <summary>
@@ -53,7 +94,8 @@
[TestFixtureTearDown]
protected virtual void TearDownFixture()
{
- factory = null;
+ factoryGet = null;
+ factorySet = null;
}
/// <summary>
@@ -66,7 +108,7 @@
prop.Int = -99;
// Property accessor
- intAccessor.Set(prop, null);
+ intSetAccessor.Set(prop, null);
Assert.AreEqual(0, prop.Int);
}
@@ -81,7 +123,7 @@
// Property accessor
int test = 57;
- intAccessor.Set(prop, test);
+ intSetAccessor.Set(prop, test);
Assert.AreEqual(test, prop.Int);
}
@@ -96,7 +138,7 @@
prop.Int = test;
// Property accessor
- Assert.AreEqual(test, intAccessor.Get(prop));
+ Assert.AreEqual(test, intGetAccessor.Get(prop));
}
/// <summary>
@@ -109,7 +151,7 @@
prop.Long = 78945566664213223;
// Property accessor
- longAccessor.Set(prop, null);
+ longSetAccessor.Set(prop, null);
Assert.AreEqual((long)0, prop.Long);
}
@@ -124,7 +166,7 @@
// Property accessor
long test = 123456789987456;
- longAccessor.Set(prop, test);
+ longSetAccessor.Set(prop, test);
Assert.AreEqual(test, prop.Long);
}
@@ -139,7 +181,7 @@
prop.Long = test;
// Property accessor
- Assert.AreEqual(test, longAccessor.Get(prop));
+ Assert.AreEqual(test, longGetAccessor.Get(prop));
}
/// <summary>
@@ -152,7 +194,7 @@
prop.SByte = 78;
// Property accessor
- sbyteAccessor.Set(prop, null);
+ sbyteSetAccessor.Set(prop, null);
Assert.AreEqual((sbyte)0, prop.SByte);
}
@@ -167,7 +209,7 @@
// Property accessor
sbyte test = 19;
- sbyteAccessor.Set(prop, test);
+ sbyteSetAccessor.Set(prop, test);
Assert.AreEqual(test, prop.SByte);
}
@@ -182,7 +224,7 @@
prop.SByte = test;
// Property accessor
- Assert.AreEqual(test, sbyteAccessor.Get(prop));
+ Assert.AreEqual(test, sbyteGetAccessor.Get(prop));
}
/// <summary>
@@ -195,7 +237,7 @@
prop.String = "abc";
// Property accessor
- stringAccessor.Set(prop, null);
+ stringSetAccessor.Set(prop, null);
Assert.IsNull(prop.String);
}
@@ -210,7 +252,7 @@
// Property accessor
string test = "wxc";
- stringAccessor.Set(prop, test);
+ stringSetAccessor.Set(prop, test);
Assert.AreEqual(test, prop.String);
}
@@ -225,7 +267,7 @@
prop.String = test;
// Property accessor
- Assert.AreEqual(test, stringAccessor.Get(prop));
+ Assert.AreEqual(test, stringGetAccessor.Get(prop));
}
/// <summary>
@@ -238,7 +280,7 @@
prop.DateTime = DateTime.Now;
// Property accessor
- datetimeAccessor.Set(prop, null);
+ datetimeSetAccessor.Set(prop, null);
Assert.AreEqual(DateTime.MinValue, prop.DateTime);
}
@@ -253,7 +295,7 @@
// Property accessor
DateTime test = new DateTime(1987,11,25);
- datetimeAccessor.Set(prop, test);
+ datetimeSetAccessor.Set(prop, test);
Assert.AreEqual(test, prop.DateTime);
}
@@ -268,7 +310,7 @@
prop.DateTime = test;
// Property accessor
- Assert.AreEqual(test, datetimeAccessor.Get(prop));
+ Assert.AreEqual(test, datetimeGetAccessor.Get(prop));
}
/// <summary>
@@ -281,7 +323,7 @@
prop.Decimal = 45.187M;
// Property accessor
- decimalAccessor.Set(prop, null);
+ decimalSetAccessor.Set(prop, null);
Assert.AreEqual(0.0M, prop.Decimal);
}
@@ -296,7 +338,7 @@
// Property accessor
Decimal test = 789456.141516M;
- decimalAccessor.Set(prop, test);
+ decimalSetAccessor.Set(prop, test);
Assert.AreEqual(test, prop.Decimal);
}
@@ -311,7 +353,7 @@
prop.Decimal = test;
// Property accessor
- Assert.AreEqual(test, decimalAccessor.Get(prop));
+ Assert.AreEqual(test, decimalGetAccessor.Get(prop));
}
/// <summary>
@@ -324,7 +366,7 @@
prop.Byte = 78;
// Property accessor
- byteAccessor.Set(prop, null);
+ byteSetAccessor.Set(prop, null);
Assert.AreEqual((byte)0, prop.Byte);
}
@@ -339,7 +381,7 @@
// Property accessor
byte test = 94;
- byteAccessor.Set(prop, test);
+ byteSetAccessor.Set(prop, test);
Assert.AreEqual(test, prop.Byte);
}
@@ -354,7 +396,7 @@
prop.Byte = test;
// Property accessor
- Assert.AreEqual(test, byteAccessor.Get(prop));
+ Assert.AreEqual(test, byteGetAccessor.Get(prop));
}
/// <summary>
@@ -367,7 +409,7 @@
prop.Char = 'r';
// Property accessor
- charAccessor.Set(prop, null);
+ charSetAccessor.Set(prop, null);
Assert.AreEqual('\0', prop.Char);
}
@@ -382,7 +424,7 @@
// Property accessor
char test = 'j';
- charAccessor.Set(prop, test);
+ charSetAccessor.Set(prop, test);
Assert.AreEqual(test, prop.Char);
}
@@ -397,7 +439,7 @@
prop.Char = test;
// Property accessor
- Assert.AreEqual(test, charAccessor.Get(prop));
+ Assert.AreEqual(test, charGetAccessor.Get(prop));
}
/// <summary>
@@ -410,7 +452,7 @@
prop.Short = 5;
// Property accessor
- shortAccessor.Set(prop, null);
+ shortSetAccessor.Set(prop, null);
Assert.AreEqual((short)0, prop.Short);
}
@@ -425,7 +467,7 @@
// Property accessor
short test = 45;
- shortAccessor.Set(prop, test);
+ shortSetAccessor.Set(prop, test);
Assert.AreEqual(test, prop.Short);
}
@@ -440,7 +482,7 @@
prop.Short = test;
// Property accessor
- Assert.AreEqual(test, shortAccessor.Get(prop));
+ Assert.AreEqual(test, shortGetAccessor.Get(prop));
}
/// <summary>
@@ -453,7 +495,7 @@
prop.UShort = 5;
// Property accessor
- ushortAccessor.Set(prop, null);
+ ushortSetAccessor.Set(prop, null);
Assert.AreEqual((ushort)0, prop.UShort);
}
@@ -468,7 +510,7 @@
// Property accessor
ushort test = 45;
- ushortAccessor.Set(prop, test);
+ ushortSetAccessor.Set(prop, test);
Assert.AreEqual(test, prop.UShort);
}
@@ -483,7 +525,7 @@
prop.UShort = test;
// Property accessor
- Assert.AreEqual(test, ushortAccessor.Get(prop));
+ Assert.AreEqual(test, ushortGetAccessor.Get(prop));
}
/// <summary>
@@ -496,7 +538,7 @@
prop.UInt = 5;
// Property accessor
- uintAccessor.Set(prop, null);
+ uintSetAccessor.Set(prop, null);
Assert.AreEqual((uint)0, prop.UInt);
}
@@ -511,7 +553,7 @@
// Property accessor
uint test = 45;
- uintAccessor.Set(prop, test);
+ uintSetAccessor.Set(prop, test);
Assert.AreEqual(test, prop.UInt);
}
@@ -526,7 +568,7 @@
prop.UInt = test;
// Property accessor
- Assert.AreEqual(test, uintAccessor.Get(prop));
+ Assert.AreEqual(test, uintGetAccessor.Get(prop));
}
/// <summary>
@@ -539,7 +581,7 @@
prop.ULong = 5L;
// Property accessor
- ulongAccessor.Set(prop, null);
+ ulongSetAccessor.Set(prop, null);
Assert.AreEqual((ulong)0, prop.ULong);
}
@@ -554,7 +596,7 @@
// Property accessor
ulong test = 45;
- ulongAccessor.Set(prop, test);
+ ulongSetAccessor.Set(prop, test);
Assert.AreEqual(test, prop.ULong);
}
@@ -569,7 +611,7 @@
prop.ULong = test;
// Property accessor
- Assert.AreEqual(test, ulongAccessor.Get(prop));
+ Assert.AreEqual(test, ulongGetAccessor.Get(prop));
}
/// <summary>
@@ -582,7 +624,7 @@
prop.Bool = true;
// Property accessor
- boolAccessor.Set(prop, null);
+ boolSetAccessor.Set(prop, null);
Assert.AreEqual(false, prop.Bool);
}
@@ -597,7 +639,7 @@
// Property accessor
bool test = true;
- boolAccessor.Set(prop, test);
+ boolSetAccessor.Set(prop, test);
Assert.AreEqual(test, prop.Bool);
}
@@ -612,7 +654,7 @@
prop.Bool = test;
// Property accessor
- Assert.AreEqual(test, boolAccessor.Get(prop));
+ Assert.AreEqual(test, boolGetAccessor.Get(prop));
}
/// <summary>
@@ -625,7 +667,7 @@
prop.Double = 788956.56D;
// Property accessor
- doubleAccessor.Set(prop, null);
+ doubleSetAccessor.Set(prop, null);
Assert.AreEqual(0.0D, prop.Double);
}
@@ -640,7 +682,7 @@
// Property accessor
double test = 788956.56D;
- doubleAccessor.Set(prop, test);
+ doubleSetAccessor.Set(prop, test);
Assert.AreEqual(test, prop.Double);
}
@@ -655,7 +697,7 @@
prop.Double = test;
// Property accessor
- Assert.AreEqual(test, doubleAccessor.Get(prop));
+ Assert.AreEqual(test, doubleGetAccessor.Get(prop));
}
/// <summary>
@@ -668,7 +710,7 @@
prop.Float = 565.45F;
// Property accessor
- floatAccessor.Set(prop, null);
+ floatSetAccessor.Set(prop, null);
Assert.AreEqual(0.0D, prop.Float);
}
@@ -683,7 +725,7 @@
// Property accessor
float test = 4567.45F;
- floatAccessor.Set(prop, test);
+ floatSetAccessor.Set(prop, test);
Assert.AreEqual(test, prop.Float);
}
@@ -698,7 +740,7 @@
prop.Float = test;
// Property accessor
- Assert.AreEqual(test, floatAccessor.Get(prop));
+ Assert.AreEqual(test, floatGetAccessor.Get(prop));
}
@@ -712,7 +754,7 @@
prop.Guid = Guid.NewGuid();
// Property accessor
- guidAccessor.Set(prop, null);
+ guidSetAccessor.Set(prop, null);
Assert.AreEqual(Guid.Empty, prop.Guid);
}
@@ -727,7 +769,7 @@
// Property accessor
Guid test = Guid.NewGuid();
- guidAccessor.Set(prop, test);
+ guidSetAccessor.Set(prop, test);
Assert.AreEqual(test, prop.Guid);
}
@@ -742,7 +784,7 @@
prop.Guid = test;
// Property accessor
- Assert.AreEqual(test, guidAccessor.Get(prop));
+ Assert.AreEqual(test, guidGetAccessor.Get(prop));
}
@@ -756,8 +798,8 @@
prop.TimeSpan = new TimeSpan(5, 12, 57, 21, 13);
// Property accessor
- timespanAccessor.Set(prop, null);
- Assert.AreEqual(TimeSpan.MinValue, prop.TimeSpan);
+ timespanSetAccessor.Set(prop, null);
+ Assert.AreEqual(new TimeSpan(0,0,0), prop.TimeSpan);
}
/// <summary>
@@ -771,7 +813,7 @@
// Property accessor
TimeSpan test = new TimeSpan(15, 5, 21, 45, 35);
- timespanAccessor.Set(prop, test);
+ timespanSetAccessor.Set(prop, test);
Assert.AreEqual(test, prop.TimeSpan);
}
@@ -786,7 +828,7 @@
prop.TimeSpan = test;
// Property accessor
- Assert.AreEqual(test, timespanAccessor.Get(prop));
+ Assert.AreEqual(test, timespanGetAccessor.Get(prop));
}
/// <summary>
@@ -800,7 +842,7 @@
prop.Account.FirstName = "test";
// Property accessor
- accountAccessor.Set(prop, null);
+ accountSetAccessor.Set(prop, null);
Assert.AreEqual(null, prop.Account);
}
@@ -818,7 +860,7 @@
// Property accessor
Assert.AreEqual(HashCodeProvider.GetIdentityHashCode(test), HashCodeProvider.GetIdentityHashCode(prop.Account));
- Assert.AreEqual(test.FirstName, ((Account)accountAccessor.Get(prop)).FirstName);
+ Assert.AreEqual(test.FirstName, ((Account)accountGetAccessor.Get(prop)).FirstName);
}
/// <summary>
@@ -835,7 +877,7 @@
string firstName = "Gilles";
Account test = new Account();
test.FirstName = firstName;
- accountAccessor.Set(prop, test);
+ accountSetAccessor.Set(prop, test);
Assert.AreEqual(firstName, prop.Account.FirstName);
}
@@ -853,7 +895,7 @@
propertyInfo.SetValue(prop, null, null);
// Property accessor
- enumAccessor.Set(prop, null);
+ enumSetAccessor.Set(prop, null);
Assert.AreEqual(TimeSpan.MinValue, prop.TimeSpan);
}
@@ -868,7 +910,7 @@
// Property accessor
Days test = Days.Wed;
- enumAccessor.Set(prop, test);
+ enumSetAccessor.Set(prop, test);
Assert.AreEqual(test, prop.Day);
}
@@ -883,7 +925,7 @@
prop.Day = test;
// Property accessor
- Assert.AreEqual(test, enumAccessor.Get(prop));
+ Assert.AreEqual(test, enumGetAccessor.Get(prop));
}
#if dotnet2
@@ -897,7 +939,7 @@
prop.IntNullable = 85;
// Property accessor
- nullableAccessor.Set(prop, null);
+ nullableSetAccessor.Set(prop, null);
Assert.AreEqual(null, prop.IntNullable);
}
@@ -912,7 +954,7 @@
prop.IntNullable = test;
// Property accessor
- Assert.AreEqual(test, nullableAccessor.Get(prop));
+ Assert.AreEqual(test, nullableGetAccessor.Get(prop));
}
/// <summary>
@@ -926,7 +968,7 @@
// Property accessor
Int32? test = 55;
- nullableAccessor.Set(prop, test);
+ nullableSetAccessor.Set(prop, test);
Assert.AreEqual(test, prop.IntNullable);
}
Modified: ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/FieldAccessorTest.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/FieldAccessorTest.cs?rev=405046&r1=405045&r2=405046&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/FieldAccessorTest.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/FieldAccessorTest.cs Mon May 8 06:21:44 2006
@@ -22,27 +22,66 @@
[SetUp]
public void SetUp()
{
- intAccessor = factory.CreateMemberAccessor(typeof(Property), "Int");
- longAccessor = factory.CreateMemberAccessor(typeof(Property), "Long");
- sbyteAccessor = factory.CreateMemberAccessor(typeof(Property), "SByte");
- stringAccessor = factory.CreateMemberAccessor(typeof(Property), "String");
- datetimeAccessor = factory.CreateMemberAccessor(typeof(Property), "DateTime");
- decimalAccessor = factory.CreateMemberAccessor(typeof(Property), "Decimal");
- byteAccessor = factory.CreateMemberAccessor(typeof(Property), "Byte");
- charAccessor = factory.CreateMemberAccessor(typeof(Property), "Char");
- shortAccessor = factory.CreateMemberAccessor(typeof(Property), "Short");
- ushortAccessor = factory.CreateMemberAccessor(typeof(Property), "UShort");
- uintAccessor = factory.CreateMemberAccessor(typeof(Property), "UInt");
- ulongAccessor = factory.CreateMemberAccessor(typeof(Property), "ULong");
- boolAccessor = factory.CreateMemberAccessor(typeof(Property), "Bool");
- doubleAccessor = factory.CreateMemberAccessor(typeof(Property), "Double");
- floatAccessor = factory.CreateMemberAccessor(typeof(Property), "Float");
- guidAccessor = factory.CreateMemberAccessor(typeof(Property), "Guid");
- timespanAccessor = factory.CreateMemberAccessor(typeof(Property), "TimeSpan");
- accountAccessor = factory.CreateMemberAccessor(typeof(Property), "Account");
- enumAccessor = factory.CreateMemberAccessor(typeof(Property), "Day");
+ intSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "_int");
+ intGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "_int");
+
+ longSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "_long");
+ longGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "_long");
+
+ sbyteSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "_sbyte");
+ sbyteGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "_sbyte");
+
+ stringSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "_string");
+ stringGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "_string");
+
+ datetimeSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "_dateTime");
+ datetimeGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "_dateTime");
+
+ decimalSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "_decimal");
+ decimalGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "_decimal");
+
+ byteSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "_byte");
+ byteGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "_byte");
+
+ charSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "_char");
+ charGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "_char");
+
+ shortSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "_short");
+ shortGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "_short");
+
+ ushortSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "_ushort");
+ ushortGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "_ushort");
+
+ uintSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "_uint");
+ uintGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "_uint");
+
+ ulongSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "_ulong");
+ ulongGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "_ulong");
+
+ boolSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "_bool");
+ boolGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "_bool");
+
+ doubleSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "_double");
+ doubleGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "_double");
+
+ floatSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "_float");
+ floatGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "_float");
+
+ guidSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "_guid");
+ guidGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "_guid");
+
+ timespanSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "_timeSpan");
+ timespanGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "_timeSpan");
+
+ accountSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "_account");
+ accountGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "_account");
+
+ enumSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "_day");
+ enumGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "_day");
+
#if dotnet2
- nullableAccessor = factory.CreateMemberAccessor(typeof(Property), "IntNullable");
+ nullableSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "_intNullable");
+ nullableGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "_intNullable");
#endif
}
@@ -67,8 +106,8 @@
prop.publicInt = -99;
// Property accessor
- IMemberAccessor memberAccessor = factory.CreateMemberAccessor(typeof(Property), "publicInt");
- memberAccessor.Set(prop, null);
+ ISetAccessor setAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicInt");
+ setAccessor.Set(prop, null);
Assert.AreEqual(0, prop.publicInt);
}
@@ -83,8 +122,8 @@
// Property accessor
int test = 57;
- IMemberAccessor memberAccessor = factory.CreateMemberAccessor(typeof(Property), "publicInt");
- memberAccessor.Set(prop, test);
+ ISetAccessor setAccessor = factorySet.CreateSetAccessor(typeof(Property), "publicInt");
+ setAccessor.Set(prop, test);
Assert.AreEqual(test, prop.publicInt);
}
@@ -99,39 +138,9 @@
prop.publicInt = test;
// Property accessor
- IMemberAccessor memberAccessor = factory.CreateMemberAccessor(typeof(Property), "publicInt");
- Assert.AreEqual(test, memberAccessor.Get(prop));
+ IGetAccessor getAccessor = factoryGet.CreateGetAccessor(typeof(Property), "publicInt");
+ Assert.AreEqual(test, getAccessor.Get(prop));
}
- /// <summary>
- /// Test setting an integer private field.
- /// </summary>
- [Test]
- public void TestSetPrivateFieldInteger()
- {
- Property prop = new Property();
- prop.Int = -99;
-
- // Property accessor
- int test = 57;
- IMemberAccessor memberAccessor = factory.CreateMemberAccessor(typeof(Property), "_int");
- memberAccessor.Set(prop, test);
- Assert.AreEqual(test, prop.Int);
- }
-
- /// <summary>
- /// Test getting an integer private field.
- /// </summary>
- [Test]
- public void TestGetPrivateFieldInteger()
- {
- int test = -99;
- Property prop = new Property();
- prop.Int = test;
-
- // Property accessor
- IMemberAccessor memberAccessor = factory.CreateMemberAccessor(typeof(Property), "_int");
- Assert.AreEqual(test, memberAccessor.Get(prop));
- }
}
}
Modified: ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/PropertyAccessorPerformance.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/PropertyAccessorPerformance.cs?rev=405046&r1=405045&r2=405046&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/PropertyAccessorPerformance.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/PropertyAccessorPerformance.cs Mon May 8 06:21:44 2006
@@ -61,8 +61,8 @@
GC.Collect();
GC.WaitForPendingFinalizers();
- MemberAccessorFactory factory = new MemberAccessorFactory(true);
- IMemberAccessor propertyAccessor = factory.CreateMemberAccessor(typeof(Property), "Int");
+ IGetAccessorFactory factory = new GetAccessorFactory(true);
+ IGetAccessor propertyAccessor = factory.CreateGetAccessor(typeof(Property), "Int");
timer.Start();
for (int i = 0; i < TEST_ITERATIONS; i++)
{
@@ -167,8 +167,8 @@
GC.Collect();
GC.WaitForPendingFinalizers();
- MemberAccessorFactory factory = new MemberAccessorFactory(true);
- IMemberAccessor propertyAccessor = factory.CreateMemberAccessor(typeof(Property), "Int");
+ ISetAccessorFactory factory = new SetAccessorFactory(true);
+ ISetAccessor propertyAccessor = factory.CreateSetAccessor(typeof(Property), "Int");
timer.Start();
for (int i = 0; i < TEST_ITERATIONS; i++)
{
Modified: ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/PropertyAccessorTest.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common.Test/NUnit/CommonTests/Utilities/PropertyAccessorTest.cs?rev=405046&r1=405045&r2=405046&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 Mon May 8 06:21:44 2006
@@ -2,6 +2,7 @@
using System.Reflection;
using IBatisNet.Common.Test.Domain;
using IBatisNet.Common.Utilities;
+using IBatisNet.Common.Utilities.Objects;
using IBatisNet.Common.Utilities.Objects.Members;
using NUnit.Framework;
@@ -18,27 +19,66 @@
[SetUp]
public void SetUp()
{
- intAccessor = factory.CreateMemberAccessor(typeof(Property), "Int");
- longAccessor = factory.CreateMemberAccessor(typeof(Property), "Long");
- sbyteAccessor = factory.CreateMemberAccessor(typeof(Property), "SByte");
- stringAccessor = factory.CreateMemberAccessor(typeof(Property), "String");
- datetimeAccessor = factory.CreateMemberAccessor(typeof(Property), "DateTime");
- decimalAccessor = factory.CreateMemberAccessor(typeof(Property), "Decimal");
- byteAccessor = factory.CreateMemberAccessor(typeof(Property), "Byte");
- charAccessor = factory.CreateMemberAccessor(typeof(Property), "Char");
- shortAccessor = factory.CreateMemberAccessor(typeof(Property), "Short");
- ushortAccessor = factory.CreateMemberAccessor(typeof(Property), "UShort");
- uintAccessor = factory.CreateMemberAccessor(typeof(Property), "UInt");
- ulongAccessor = factory.CreateMemberAccessor(typeof(Property), "ULong");
- boolAccessor = factory.CreateMemberAccessor(typeof(Property), "Bool");
- doubleAccessor = factory.CreateMemberAccessor(typeof(Property), "Double");
- floatAccessor = factory.CreateMemberAccessor(typeof(Property), "Float");
- guidAccessor = factory.CreateMemberAccessor(typeof(Property), "Guid");
- timespanAccessor = factory.CreateMemberAccessor(typeof(Property), "TimeSpan");
- accountAccessor = factory.CreateMemberAccessor(typeof(Property), "Account");
- enumAccessor = factory.CreateMemberAccessor(typeof(Property), "Day");
+ intSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "Int");
+ intGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "Int");
+
+ longSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "Long");
+ longGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "Long");
+
+ sbyteSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "SByte");
+ sbyteGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "SByte");
+
+ stringSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "String");
+ stringGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "String");
+
+ datetimeSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "DateTime");
+ datetimeGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "DateTime");
+
+ decimalSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "Decimal");
+ decimalGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "Decimal");
+
+ byteSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "Byte");
+ byteGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "Byte");
+
+ charSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "Char");
+ charGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "Char");
+
+ shortSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "Short");
+ shortGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "Short");
+
+ ushortSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "UShort");
+ ushortGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "UShort");
+
+ uintSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "UInt");
+ uintGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "UInt");
+
+ ulongSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "ULong");
+ ulongGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "ULong");
+
+ boolSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "Bool");
+ boolGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "Bool");
+
+ doubleSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "Double");
+ doubleGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "Double");
+
+ floatSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "Float");
+ floatGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "Float");
+
+ guidSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "Guid");
+ guidGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "Guid");
+
+ timespanSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "TimeSpan");
+ timespanGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "TimeSpan");
+
+ accountSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "Account");
+ accountGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "Account");
+
+ enumSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "Day");
+ enumGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "Day");
+
#if dotnet2
- nullableAccessor = factory.CreateMemberAccessor(typeof(Property), "IntNullable");
+ nullableSetAccessor = factorySet.CreateSetAccessor(typeof(Property), "IntNullable");
+ nullableGetAccessor = factoryGet.CreateGetAccessor(typeof(Property), "IntNullable");
#endif
}
@@ -53,38 +93,130 @@
#endregion
- ///// <summary>
- ///// Test MemberAccessorFactory
- ///// </summary>
- //[Test]
- //public void TestMemberAccessorFactory()
- //{
- // IMemberAccessor propertyAccessor1 = factory.CreateMemberAccessor(typeof(Property), "Int");
- // IMemberAccessor propertyAccessor2 = factory.CreateMemberAccessor(typeof(Property), "Int");
-
- // Assert.AreEqual(HashCodeProvider.GetIdentityHashCode(propertyAccessor1), HashCodeProvider.GetIdentityHashCode(propertyAccessor2) );
- //}
-
- ///// <summary>
- ///// Test multiple MemberAccessorFactory
- ///// </summary>
- //[Test]
- //public void TestMultipleMemberAccessorFactory()
- //{
- // Property prop = new Property();
- // IMemberAccessor propertyAccessor1 = factory1.CreateMemberAccessor(typeof(Property), "Int");
-
- // MemberAccessorFactory factory2 = new MemberAccessorFactory(true);
- // IMemberAccessor propertyAccessor2 = factory2.CreateMemberAccessor(typeof(Property), "Int");
-
- // Assert.AreEqual(int.MinValue, propertyAccessor1.Get(prop));
- // Assert.AreEqual(int.MinValue, propertyAccessor2.Get(prop));
- //}
+ /// <summary>
+ /// Test multiple call to factory
+ /// </summary>
+ [Test]
+ public void TestMemberAccessorFactory()
+ {
+ IGetAccessor accessor11 = factoryGet.CreateGetAccessor(typeof(Property), "Int");
+ IGetAccessor accessor12 = factoryGet.CreateGetAccessor(typeof(Property), "Int");
+
+ Assert.AreEqual(HashCodeProvider.GetIdentityHashCode(accessor11), HashCodeProvider.GetIdentityHashCode(accessor12));
+
+ ISetAccessor accessor21 = factorySet.CreateSetAccessor(typeof(Property), "Int");
+ ISetAccessor accessor22 = factorySet.CreateSetAccessor(typeof(Property), "Int");
+
+ Assert.AreEqual(HashCodeProvider.GetIdentityHashCode(accessor21), HashCodeProvider.GetIdentityHashCode(accessor22));
+
+ }
+
+ /// <summary>
+ /// Test multiple IGetAccessor
+ /// </summary>
+ [Test]
+ public void TestMultipleMemberAccessorFactory()
+ {
+ Property prop = new Property();
+ IGetAccessor accessor1 = factoryGet.CreateGetAccessor(typeof(Property), "Int");
+
+ IGetAccessorFactory factory2 = new GetAccessorFactory(true);
+ IGetAccessor accessor2 = factory2.CreateGetAccessor(typeof(Property), "Int");
+
+ Assert.AreEqual(int.MinValue, accessor1.Get(prop));
+ Assert.AreEqual(int.MinValue, accessor2.Get(prop));
+ }
+
+
+ /// <summary>
+ /// Test accessor on virtual property
+ /// </summary>
+ [Test]
+ [ExpectedException(typeof(InvalidOperationException), "Test virtual")]
+ public void TestVirtualIMemberAccessor1()
+ {
+ IGetAccessor accessorGet = factoryGet.CreateGetAccessor(typeof(PropertySon), "Account");
+ ISetAccessor accessorSet = factorySet.CreateSetAccessor(typeof(PropertySon), "Account");
+
+ PropertySon prop = new PropertySon();
+
+ PropertySon son = new PropertySon();
+ Account account = (Account)accessorGet.Get(son);
+
+ Assert.IsTrue(account.Days == Days.Wed);
+ accessorSet.Set(son, new Account());
+ }
+
+ /// <summary>
+ /// Test accessor on virtual property
+ /// </summary>
+ [Test]
+ [ExpectedException(typeof(InvalidOperationException), "Test virtual")]
+ public void TestVirtualIMemberAccessor2()
+ {
+ IGetAccessor accessorGet = factoryGet.CreateGetAccessor(typeof(PropertySon), "Int");
+ ISetAccessor accessorSet = factorySet.CreateSetAccessor(typeof(PropertySon), "Int");
+ PropertySon prop = new PropertySon();
+ PropertySon son = new PropertySon();
+ Int32 i = (Int32)accessorGet.Get(son);
+ Assert.IsTrue(i == -88);
+ accessorSet.Set(son, 9);
+ }
+ /// <summary>
+ /// Test IMemberAccessor on virtual property
+ /// </summary>
+ [Test]
+ [ExpectedException(typeof(InvalidOperationException), "Test virtual")]
+ public void TestVirtualIMemberAccessor3()
+ {
+ IGetAccessor accessorGet = factoryGet.CreateGetAccessor(typeof(PropertySon), "DateTime");
+ ISetAccessor accessorSet = factorySet.CreateSetAccessor(typeof(PropertySon), "DateTime");
+
+ PropertySon prop = new PropertySon();
+ PropertySon son = new PropertySon();
+ DateTime date = (DateTime)accessorGet.Get(son);
+
+ Assert.AreEqual(new DateTime(2000,1,1), date);
+ accessorSet.Set(son, DateTime.Now);
+ }
+
+ /// <summary>
+ /// Test IMemberAccessor on private set property
+ /// </summary>
+ [Test]
+ public void TestPrivateSetAccessor()
+ {
+ ISetAccessor accessorSet = factorySet.CreateSetAccessor(typeof(PropertySon), "PrivateIndex");
+
+ PropertySon prop = new PropertySon();
+
+ PropertySon son = new PropertySon();
+ accessorSet.Set(son, -99);
+
+ Assert.AreEqual(-99, son.Index);
+ }
+
+ /// <summary>
+ /// Test IMemberAccessor on protected set property
+ /// </summary>
+ [Test]
+ public void TestProtectedSetAccessor()
+ {
+ ISetAccessor accessorSet = factorySet.CreateSetAccessor(typeof(PropertySon), "Index");
+
+ PropertySon prop = new PropertySon();
+
+ PropertySon son = new PropertySon();
+ accessorSet.Set(son, -99);
+
+ Assert.AreEqual(-99, son.Index);
+ }
}
+
}
Modified: ibatis/trunk/cs/mapper/IBatisNet.Common/IBatisNet.Common.2005.csproj
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common/IBatisNet.Common.2005.csproj?rev=405046&r1=405045&r2=405046&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/IBatisNet.Common.2005.csproj (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/IBatisNet.Common.2005.csproj Mon May 8 06:21:44 2006
@@ -201,19 +201,30 @@
<Compile Include="Utilities\Objects\FactoryBuilder.cs" />
<Compile Include="Utilities\Objects\IFactory.cs" />
<Compile Include="Utilities\Objects\IObjectFactory.cs" />
+ <Compile Include="Utilities\Objects\Members\AccessorFactory.cs" />
<Compile Include="Utilities\Objects\Members\BaseAccessor.cs" />
- <Compile Include="Utilities\Objects\Members\BaseEmitAccessor.cs" />
- <Compile Include="Utilities\Objects\Members\DelegateFieldAccessor.cs" />
+ <Compile Include="Utilities\Objects\Members\DelegateGetFieldAccessor.cs" />
<Compile Include="Utilities\Objects\Members\DelegateObjectFactory.cs" />
- <Compile Include="Utilities\Objects\Members\DelegatePropertyAccessor.cs" />
- <Compile Include="Utilities\Objects\Members\EmitFieldAccessor.cs" />
- <Compile Include="Utilities\Objects\Members\EmitPropertyAccessor.cs" />
- <Compile Include="Utilities\Objects\Members\IMemberAccessor.cs" />
- <Compile Include="Utilities\Objects\Members\IMemberAccessorFactory.cs" />
- <Compile Include="Utilities\Objects\Members\IPropertyAccessor.cs" />
- <Compile Include="Utilities\Objects\Members\MemberAccessorFactory.cs" />
- <Compile Include="Utilities\Objects\Members\ReflectionFieldAccessor.cs" />
- <Compile Include="Utilities\Objects\Members\ReflectionPropertyAccessor.cs" />
+ <Compile Include="Utilities\Objects\Members\DelegatePropertyGetAccessor.cs" />
+ <Compile Include="Utilities\Objects\Members\DelegatePropertySetAccessor.cs" />
+ <Compile Include="Utilities\Objects\Members\DelegateSetFieldAccessor.cs" />
+ <Compile Include="Utilities\Objects\Members\EmitFieldGetAccessor.cs" />
+ <Compile Include="Utilities\Objects\Members\EmitFieldSetAccessor.cs" />
+ <Compile Include="Utilities\Objects\Members\EmitPropertyGetAccessor.cs" />
+ <Compile Include="Utilities\Objects\Members\EmitPropertySetAccessor.cs" />
+ <Compile Include="Utilities\Objects\Members\GetAccessorFactory.cs" />
+ <Compile Include="Utilities\Objects\Members\IAccessor.cs" />
+ <Compile Include="Utilities\Objects\Members\IGet.cs" />
+ <Compile Include="Utilities\Objects\Members\IGetAccessor.cs" />
+ <Compile Include="Utilities\Objects\Members\IGetAccessorFactory.cs" />
+ <Compile Include="Utilities\Objects\Members\ISet.cs" />
+ <Compile Include="Utilities\Objects\Members\ISetAccessor.cs" />
+ <Compile Include="Utilities\Objects\Members\ISetAccessorFactory.cs" />
+ <Compile Include="Utilities\Objects\Members\ReflectionFieldGetAccessor.cs" />
+ <Compile Include="Utilities\Objects\Members\ReflectionFieldSetAccessor.cs" />
+ <Compile Include="Utilities\Objects\Members\ReflectionPropertyGetAccessor.cs" />
+ <Compile Include="Utilities\Objects\Members\ReflectionPropertySetAccessor.cs" />
+ <Compile Include="Utilities\Objects\Members\SetAccessorFactory.cs" />
<Compile Include="Utilities\Objects\ObjectFactory.cs" />
<Compile Include="Utilities\Objects\ObjectProbe.cs">
<SubType>Code</SubType>
Modified: ibatis/trunk/cs/mapper/IBatisNet.Common/IBatisNet.Common.csproj
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common/IBatisNet.Common.csproj?rev=405046&r1=405045&r2=405046&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/IBatisNet.Common.csproj (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/IBatisNet.Common.csproj Mon May 8 06:21:44 2006
@@ -350,52 +350,97 @@
BuildAction = "Compile"
/>
<File
+ RelPath = "Utilities\Objects\Members\AccessorFactory.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
RelPath = "Utilities\Objects\Members\BaseAccessor.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
- RelPath = "Utilities\Objects\Members\BaseEmitAccessor.cs"
+ RelPath = "Utilities\Objects\Members\EmitFieldGetAccessor.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Utilities\Objects\Members\EmitFieldSetAccessor.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Utilities\Objects\Members\EmitPropertyGetAccessor.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Utilities\Objects\Members\EmitPropertySetAccessor.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Utilities\Objects\Members\GetAccessorFactory.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Utilities\Objects\Members\IAccessor.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Utilities\Objects\Members\IGet.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Utilities\Objects\Members\IGetAccessor.cs"
+ SubType = "Code"
+ BuildAction = "Compile"
+ />
+ <File
+ RelPath = "Utilities\Objects\Members\IGetAccessorFactory.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
- RelPath = "Utilities\Objects\Members\EmitFieldAccessor.cs"
+ RelPath = "Utilities\Objects\Members\ISet.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
- RelPath = "Utilities\Objects\Members\EmitPropertyAccessor.cs"
+ RelPath = "Utilities\Objects\Members\ISetAccessor.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
- RelPath = "Utilities\Objects\Members\IMemberAccessor.cs"
+ RelPath = "Utilities\Objects\Members\ISetAccessorFactory.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
- RelPath = "Utilities\Objects\Members\IMemberAccessorFactory.cs"
+ RelPath = "Utilities\Objects\Members\ReflectionFieldGetAccessor.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
- RelPath = "Utilities\Objects\Members\IPropertyAccessor.cs"
+ RelPath = "Utilities\Objects\Members\ReflectionFieldSetAccessor.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
- RelPath = "Utilities\Objects\Members\MemberAccessorFactory.cs"
+ RelPath = "Utilities\Objects\Members\ReflectionPropertyGetAccessor.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
- RelPath = "Utilities\Objects\Members\ReflectionFieldAccessor.cs"
+ RelPath = "Utilities\Objects\Members\ReflectionPropertySetAccessor.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
- RelPath = "Utilities\Objects\Members\ReflectionPropertyAccessor.cs"
+ RelPath = "Utilities\Objects\Members\SetAccessorFactory.cs"
SubType = "Code"
BuildAction = "Compile"
/>
Modified: ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/DelegateAObjectFactory.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/DelegateAObjectFactory.cs?rev=405046&r1=405045&r2=405046&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/DelegateAObjectFactory.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/DelegateAObjectFactory.cs Mon May 8 06:21:44 2006
@@ -54,7 +54,7 @@
/// </summary>
/// <param name="typeToCreate">The type instance to build</param>
/// <param name="types">The types of the constructor arguments</param>
- /// <returns>Returns a new see <cref="IFactory"/> instance.</returns>
+ /// <returns>Returns a new see <see cref="IFactory"/> instance.</returns>
[MethodImpl(MethodImplOptions.Synchronized)]
public IFactory CreateFactory(Type typeToCreate, Type[] types)
{
Added: ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/AccessorFactory.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/AccessorFactory.cs?rev=405046&view=auto
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/AccessorFactory.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/AccessorFactory.cs Mon May 8 06:21:44 2006
@@ -0,0 +1,64 @@
+#region Apache Notice
+/*****************************************************************************
+ * $Revision: 374175 $
+ * $LastChangedDate: 2006-04-25 19:40:27 +0200 (mar., 25 avr. 2006) $
+ * $LastChangedBy: gbayon $
+ *
+ * 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
+
+namespace IBatisNet.Common.Utilities.Objects.Members
+{
+ /// <summary>
+ /// Accessor factory
+ /// </summary>
+ public class AccessorFactory
+ {
+ private ISetAccessorFactory _setAccessorFactory = null;
+ private IGetAccessorFactory _getAccessorFactory = null;
+
+ /// <summary>
+ /// The factory which build <see cref="ISetAccessor"/>
+ /// </summary>
+ public ISetAccessorFactory SetAccessorFactory
+ {
+ get { return _setAccessorFactory; }
+ }
+
+ /// <summary>
+ /// The factory which build <see cref="IGetAccessor"/>
+ /// </summary>
+ public IGetAccessorFactory GetAccessorFactory
+ {
+ get { return _getAccessorFactory; }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AccessorFactory"/> class.
+ /// </summary>
+ /// <param name="setAccessorFactory">The set accessor factory.</param>
+ /// <param name="getAccessorFactory">The get accessor factory.</param>
+ public AccessorFactory(ISetAccessorFactory setAccessorFactory,
+ IGetAccessorFactory getAccessorFactory)
+ {
+ _setAccessorFactory = setAccessorFactory;
+ _getAccessorFactory = getAccessorFactory;
+ }
+ }
+}
Modified: ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/BaseAccessor.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/BaseAccessor.cs?rev=405046&r1=405045&r2=405046&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/BaseAccessor.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/BaseAccessor.cs Mon May 8 06:21:44 2006
@@ -33,28 +33,15 @@
/// <summary>
/// Abstract base class for member accessor
/// </summary>
- public abstract class BaseAccessor : IMemberAccessor
+ public abstract class BaseAccessor
{
/// <summary>
- /// The property/field name
- /// </summary>
- protected string memberName = string.Empty;
- /// <summary>
- /// The property/field type
- /// </summary>
- protected Type baseMemberType = null;
-
- /// <summary>
- /// The class parent type
- /// </summary>
- protected Type targetType = null;
- /// <summary>
/// The null internal value used by this member type
/// </summary>
protected object nullInternal = null;
- /// <summary>
- ///
+ /// <summary>
+ /// List of type-opCode
/// </summary>
protected static IDictionary typeToOpcode = new HybridDictionary();
@@ -113,47 +100,12 @@
if (type == typeof(DateTime)) { return DateTime.MinValue; }
if (type == typeof(Decimal)) { return 0m; }
if (type == typeof(Guid)) { return Guid.Empty; }
- if (type == typeof(TimeSpan)) { return TimeSpan.MinValue; }
+ if (type == typeof(TimeSpan)) { return new TimeSpan(0, 0, 0); }
}
}
return null;
}
- #region IMemberAccessor Members
-
- /// <summary>
- /// Gets the member name.
- /// </summary>
- /// <value></value>
- public string Name
- {
- get { return memberName; }
- }
-
- /// <summary>
- /// Gets the type of this member (field or property).
- /// </summary>
- /// <value></value>
- public Type MemberType
- {
- get { return baseMemberType; }
- }
-
- /// <summary>
- /// Gets the value stored in the field/property for the specified target.
- /// </summary>
- /// <param name="target">Object to retrieve the field/property from.</param>
- /// <returns>Value.</returns>
- public abstract object Get(object target);
-
- /// <summary>
- /// Sets the value for the field/property of the specified target.
- /// </summary>
- /// <param name="target">Object to set the field/property on.</param>
- /// <param name="value">Value.</param>
- public abstract void Set(object target, object value);
-
- #endregion
}
}
Modified: ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/BaseEmitAccessor.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/BaseEmitAccessor.cs?rev=405046&r1=405045&r2=405046&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/BaseEmitAccessor.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/BaseEmitAccessor.cs Mon May 8 06:21:44 2006
@@ -33,44 +33,8 @@
/// </summary>
public abstract class BaseEmitAccessor : BaseAccessor
{
- /// <summary>
- /// The IL emitted IMemberAccessor
- /// </summary>
- protected IMemberAccessor emittedMemberAccessor = null;
- /// <summary>
- /// The AssemblyBuilder use to keep the type
- /// </summary>
- protected AssemblyBuilder assemblyBuilder = null;
- /// <summary>
- /// The ModuleBuilder use to create the type
- /// </summary>
- protected ModuleBuilder moduleBuilder = null;
- /// <summary>
- /// This method create a new type oject for the the field accessor class
- /// that will provide dynamic access.
- /// </summary>
- protected void EmitIL()
- {
- // Create a new type oject for the the field accessor class.
- EmitType();
- // Create a new instance
- emittedMemberAccessor = assemblyBuilder.CreateInstance("MemberAccessorFor" + targetType.FullName + memberName) as IMemberAccessor;
-
- this.nullInternal = this.GetNullInternal(baseMemberType);
-
- if (emittedMemberAccessor == null)
- {
- throw new NotSupportedException(
- string.Format("Unable to create propert/field accessor for \"{0}\".", baseMemberType));
- }
- }
-
- /// <summary>
- /// Create an type that will provide the get and set methods.
- /// </summary>
- protected abstract void EmitType();
}
}
Added: ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/DelegateGetFieldAccessor.cs
URL: http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/DelegateGetFieldAccessor.cs?rev=405046&view=auto
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/DelegateGetFieldAccessor.cs (added)
+++ ibatis/trunk/cs/mapper/IBatisNet.Common/Utilities/Objects/Members/DelegateGetFieldAccessor.cs Mon May 8 06:21:44 2006
@@ -0,0 +1,133 @@
+#region Apache Notice
+/*****************************************************************************
+ * $Revision: 374175 $
+ * $LastChangedDate: 2006-04-09 20:24:53 +0200 (dim., 09 avr. 2006) $
+ * $LastChangedBy: gbayon $
+ *
+ * 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 System.Reflection;
+using System.Reflection.Emit;
+
+namespace IBatisNet.Common.Utilities.Objects.Members
+{
+ /// <summary>
+ /// The <see cref="DelegateFieldGetAccessor"/> class defines a field get accessor and
+ /// provides <c>Reflection.Emit</c>-generated <see cref="IGet"/>
+ /// via the new DynamicMethod (.NET V2).
+ /// </summary>
+ public sealed class DelegateFieldGetAccessor : BaseAccessor, IGetAccessor
+ {
+ private delegate object GetValue(object instance);
+
+ private GetValue _get = null;
+ /// <summary>
+ /// The field name
+ /// </summary>
+ private string _fieldName = string.Empty;
+ /// <summary>
+ /// The class parent type
+ /// </summary>
+ private Type _fieldType = null;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="T:DelegateFieldGetAccessor"/> class
+ /// for field get access via DynamicMethod.
+ /// </summary>
+ /// <param name="targetObjectType">Type of the target object.</param>
+ /// <param name="fieldName">Name of the field.</param>
+ public DelegateFieldGetAccessor(Type targetObjectType, string fieldName)
+ {
+ // this.targetType = targetObjectType;
+ _fieldName = fieldName;
+
+ FieldInfo fieldInfo = targetObjectType.GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public);
+
+ // Make sure the field exists
+ if (fieldInfo == null)
+ {
+ throw new NotSupportedException(
+ string.Format("Field \"{0}\" does not exist for type "
+ + "{1}.", fieldName, targetObjectType));
+ }
+ else
+ {
+ _fieldType = fieldInfo.FieldType;
+ this.nullInternal = this.GetNullInternal(_fieldType);
+
+ DynamicMethod dynamicMethodGet = new DynamicMethod("GetImplementation", typeof(object), new Type[] { typeof(object) }, this.GetType().Module, false);
+ ILGenerator ilgen = dynamicMethodGet.GetILGenerator();
+
+ // Emit the IL for get access.
+
+ // We need a reference to the current instance (stored in local argument index 0)
+ // so Ldfld can load from the correct instance (this one).
+ ilgen.Emit(OpCodes.Ldarg_0);
+ ilgen.Emit(OpCodes.Ldfld, fieldInfo);
+ if (_fieldType.IsValueType)
+ {
+ // Now, we execute the box opcode, which pops the value of field 'x',
+ // returning a reference to the filed value boxed as an object.
+ ilgen.Emit(OpCodes.Box, fieldInfo.FieldType);
+ }
+ ilgen.Emit(OpCodes.Ret);
+ _get = (GetValue)dynamicMethodGet.CreateDelegate(typeof(GetValue));
+ }
+ }
+
+ #region IAccessor Members
+
+
+ /// <summary>
+ /// Gets the field's name.
+ /// </summary>
+ /// <value></value>
+ public string Name
+ {
+ get { return _fieldName; }
+ }
+
+ /// <summary>
+ /// Gets the field's type.
+ /// </summary>
+ /// <value></value>
+ public Type MemberType
+ {
+ get { return _fieldType; }
+ }
+
+ #endregion
+
+ #region IGet Members
+
+ /// <summary>
+ /// Gets the field value from the specified target.
+ /// </summary>
+ /// <param name="target">Target object.</param>
+ /// <returns>Property value.</returns>
+ public object Get(object target)
+ {
+ return _get(target);
+ }
+
+ #endregion
+ }
+}