Author: gbayon
Date: Sat Nov 12 10:58:20 2005
New Revision: 332815
URL: http://svn.apache.org/viewcvs?rev=332815&view=rev
Log:
- Moved Type Alias repository in TypeHandlerFactory file
Modified:
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/ParameterProperty.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultMap.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultProperty.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/CacheModelDeSerializer.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/ParameterPropertyDeSerializer.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/TypeAliasDeSerializer.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/Statements/Statement.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TypeHandlerFactory.cs
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=332815&r1=332814&r2=332815&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/DomSqlMapBuilder.cs
Sat Nov 12 10:58:20 2005
@@ -297,7 +297,7 @@
public DomSqlMapBuilder()
{
_configScope = new ConfigurationScope();
- _paramParser = new
InlineParameterMapParser(_configScope);
+ _paramParser = new InlineParameterMapParser(
_configScope.ErrorContext );
_deSerializerFactory = new
DeSerializerFactory(_configScope);
}
@@ -314,7 +314,7 @@
{
_configScope = new ConfigurationScope();
_configScope.ValidateSqlMapConfig =
validateSqlMapConfig;
- _paramParser = new InlineParameterMapParser(
_configScope );
+ _paramParser = new InlineParameterMapParser(
_configScope.ErrorContext );
}
#endregion
@@ -635,13 +635,13 @@
TypeAlias cacheAlias = new
TypeAlias(typeof(MemoryCacheControler));
cacheAlias.Name = "MEMORY";
- _configScope.SqlMapper.AddTypeAlias(cacheAlias.Name,
cacheAlias);
+
_configScope.SqlMapper.TypeHandlerFactory.AddTypeAlias(cacheAlias.Name,
cacheAlias);
cacheAlias = new TypeAlias(typeof(LruCacheController));
cacheAlias.Name = "LRU";
- _configScope.SqlMapper.AddTypeAlias(cacheAlias.Name,
cacheAlias);
+
_configScope.SqlMapper.TypeHandlerFactory.AddTypeAlias(cacheAlias.Name,
cacheAlias);
cacheAlias = new TypeAlias(typeof(FifoCacheController));
cacheAlias.Name = "FIFO";
- _configScope.SqlMapper.AddTypeAlias(cacheAlias.Name,
cacheAlias);
+
_configScope.SqlMapper.TypeHandlerFactory.AddTypeAlias(cacheAlias.Name,
cacheAlias);
#endregion
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/InlineParameterMapParser.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/InlineParameterMapParser.cs?rev=332815&r1=332814&r2=332815&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/InlineParameterMapParser.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/InlineParameterMapParser.cs
Sat Nov 12 10:58:20 2005
@@ -52,7 +52,7 @@
private const string PARAMETER_TOKEN = "#";
private const string PARAM_DELIM = ":";
- private ConfigurationScope _configScope = null;
+ private ErrorContext _errorContext= null;
#endregion
@@ -61,10 +61,10 @@
/// <summary>
/// Constructor
/// </summary>
- /// <param name="configScope"></param>
- public InlineParameterMapParser(ConfigurationScope configScope)
+ /// <param name="errorContext"></param>
+ public InlineParameterMapParser(ErrorContext errorContext)
{
- _configScope = configScope;
+ _errorContext = errorContext;
}
#endregion
@@ -210,7 +210,7 @@
if (mapping.CallBackName.Length >0)
{
- mapping.Initialize( _configScope );
+ mapping.Initialize( typeHandlerFactory,
_errorContext );
}
else
{
@@ -226,7 +226,7 @@
mapping.CLRType, mapping.DbType
);
}
mapping.TypeHandler = handler;
- mapping.Initialize( _configScope );
+ mapping.Initialize( typeHandlerFactory,
_errorContext );
}
return mapping;
@@ -272,7 +272,7 @@
handler =
ResolveTypeHandler(typeHandlerFactory, parameterClassType, propertyName, null,
dBType);
}
mapping.TypeHandler = handler;
- mapping.Initialize(
_configScope.ErrorContext );
+ mapping.Initialize( typeHandlerFactory,
_errorContext );
}
else if (n1 >= 5)
{
@@ -302,7 +302,7 @@
handler =
ResolveTypeHandler(typeHandlerFactory, parameterClassType, propertyName, null,
dBType);
}
mapping.TypeHandler = handler;
- mapping.Initialize(
_configScope.ErrorContext );
+ mapping.Initialize( typeHandlerFactory,
_errorContext );
}
else
{
@@ -322,7 +322,7 @@
handler =
ResolveTypeHandler(typeHandlerFactory, parameterClassType, token, null, null);
}
mapping.TypeHandler = handler;
- mapping.Initialize( _configScope.ErrorContext );
+ mapping.Initialize( typeHandlerFactory,
_errorContext );
}
return mapping;
}
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/ParameterProperty.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/ParameterProperty.cs?rev=332815&r1=332814&r2=332815&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/ParameterProperty.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ParameterMapping/ParameterProperty.cs
Sat Nov 12 10:58:20 2005
@@ -245,20 +245,21 @@
/// <summary>
///
/// </summary>
- /// <param name="configScope"></param>
- public void Initialize(ConfigurationScope configScope)
+ /// <param name="typeHandlerFactory"></param>
+ /// <param name="errorContext"></param>
+ public void Initialize(TypeHandlerFactory typeHandlerFactory,
ErrorContext errorContext)
{
if(_directionAttribute.Length >0)
{
_direction = (ParameterDirection)Enum.Parse(
typeof(ParameterDirection), _directionAttribute, true );
}
- configScope.ErrorContext.MoreInfo = "Check the
parameter mapping typeHandler attribute '" + this.CallBackName + "' (must be a
ITypeHandlerCallback implementation).";
+ errorContext.MoreInfo = "Check the parameter mapping
typeHandler attribute '" + this.CallBackName + "' (must be a
ITypeHandlerCallback implementation).";
if (this.CallBackName.Length >0)
{
try
{
- Type type =
configScope.SqlMapper.GetType(this.CallBackName);
+ Type type =
typeHandlerFactory.GetType(this.CallBackName);
ITypeHandlerCallback
typeHandlerCallback = (ITypeHandlerCallback) Activator.CreateInstance( type );
_typeHandler = new
CustomTypeHandler(typeHandlerCallback);
}
@@ -271,22 +272,22 @@
{
if (this.CLRType.Length == 0 ) // Unknown
{
- _typeHandler =
configScope.TypeHandlerFactory.GetUnkownTypeHandler();
+ _typeHandler =
typeHandlerFactory.GetUnkownTypeHandler();
}
else // If we specify a CLR type, use it
{
Type type =
Resources.TypeForName(this.CLRType);
- if
(configScope.TypeHandlerFactory.IsSimpleType(type))
+ if
(typeHandlerFactory.IsSimpleType(type))
{
// Primitive
- _typeHandler =
configScope.TypeHandlerFactory.GetTypeHandler(type, _dbType);
+ _typeHandler =
typeHandlerFactory.GetTypeHandler(type, _dbType);
}
else
{
// .NET object
type =
ObjectProbe.GetPropertyTypeForGetter(type, this.PropertyName);
- _typeHandler =
configScope.TypeHandlerFactory.GetTypeHandler(type, _dbType);
+ _typeHandler =
typeHandlerFactory.GetTypeHandler(type, _dbType);
}
}
}
@@ -305,6 +306,8 @@
{
_direction = (ParameterDirection)Enum.Parse(
typeof(ParameterDirection), _directionAttribute, true );
}
+
+
}
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultMap.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultMap.cs?rev=332815&r1=332814&r2=332815&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultMap.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultMap.cs
Sat Nov 12 10:58:20 2005
@@ -199,7 +199,7 @@
{
try
{
- _class =
configScope.SqlMapper.GetType(_className);
+ _class =
configScope.SqlMapper.TypeHandlerFactory.GetType(_className);
// Load the child node
GetChildNode(configScope);
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=332815&r1=332814&r2=332815&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultProperty.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/ResultMapping/ResultProperty.cs
Sat Nov 12 10:58:20 2005
@@ -267,7 +267,7 @@
configScope.ErrorContext.MoreInfo = "Result
property '"+_propertyName+"' check the typeHandler attribute '" +
this.CallBackName + "' (must be a ITypeHandlerCallback implementation).";
try
{
- Type type =
configScope.SqlMapper.GetType(this.CallBackName);
+ Type type =
configScope.SqlMapper.TypeHandlerFactory.GetType(this.CallBackName);
ITypeHandlerCallback
typeHandlerCallback = (ITypeHandlerCallback) Activator.CreateInstance( type );
_typeHandler = new
CustomTypeHandler(typeHandlerCallback);
}
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/CacheModelDeSerializer.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/CacheModelDeSerializer.cs?rev=332815&r1=332814&r2=332815&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/CacheModelDeSerializer.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/CacheModelDeSerializer.cs
Sat Nov 12 10:58:20 2005
@@ -53,7 +53,7 @@
NameValueCollection prop =
NodeUtils.ParseAttributes(node, configScope.Properties);
model.Id = NodeUtils.GetStringAttribute(prop, "id");
model.Implementation =
NodeUtils.GetStringAttribute(prop, "implementation");
- model.Implementation =
configScope.SqlMapper.GetTypeAlias(model.Implementation).Class.AssemblyQualifiedName;
+ model.Implementation =
configScope.SqlMapper.TypeHandlerFactory.GetTypeAlias(model.Implementation).Class.AssemblyQualifiedName;
for(int i=0;i<node.ChildNodes.Count;i++)
{
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/ParameterPropertyDeSerializer.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/ParameterPropertyDeSerializer.cs?rev=332815&r1=332814&r2=332815&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/ParameterPropertyDeSerializer.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/ParameterPropertyDeSerializer.cs
Sat Nov 12 10:58:20 2005
@@ -63,7 +63,7 @@
property.Scale = NodeUtils.GetByteAttribute(prop,
"scale", 0);
property.Size = NodeUtils.GetIntAttribute(prop, "size",
-1);
- property.Initialize( configScope );
+ property.Initialize(configScope.TypeHandlerFactory,
configScope.ErrorContext);
return property;
}
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/TypeAliasDeSerializer.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/TypeAliasDeSerializer.cs?rev=332815&r1=332814&r2=332815&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/TypeAliasDeSerializer.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/TypeAliasDeSerializer.cs
Sat Nov 12 10:58:20 2005
@@ -59,7 +59,7 @@
typeAlias.Initialize();
- configScope.SqlMapper.AddTypeAlias( typeAlias.Name,
typeAlias );
+ configScope.SqlMapper.TypeHandlerFactory.AddTypeAlias(
typeAlias.Name, typeAlias );
}
}
}
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/TypeHandlerDeSerializer.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/TypeHandlerDeSerializer.cs?rev=332815&r1=332814&r2=332815&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/TypeHandlerDeSerializer.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Serializers/TypeHandlerDeSerializer.cs
Sat Nov 12 10:58:20 2005
@@ -63,7 +63,7 @@
configScope.ErrorContext.MoreInfo = "Check the callback
attribute '" + handler.CallBackName + "' (must be a classname).";
ITypeHandler typeHandler = null;
- Type type =
configScope.SqlMapper.GetType(handler.CallBackName);
+ Type type =
configScope.SqlMapper.TypeHandlerFactory.GetType(handler.CallBackName);
object impl = Activator.CreateInstance( type );
if (impl is ITypeHandlerCallback)
{
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/DynamicSql.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/DynamicSql.cs?rev=332815&r1=332814&r2=332815&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/DynamicSql.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Sql/Dynamic/DynamicSql.cs
Sat Nov 12 10:58:20 2005
@@ -35,6 +35,7 @@
using IBatisNet.DataMapper.Configuration.Sql.SimpleDynamic;
using IBatisNet.DataMapper.Configuration.Statements;
using IBatisNet.DataMapper.Scope;
+using IBatisNet.DataMapper.TypeHandlers;
#endregion
@@ -54,7 +55,7 @@
private IList _children = new ArrayList();
private IStatement _statement = null ;
private InlineParameterMapParser _paramParser = null;
- private ConfigurationScope _configScope = null;
+ private TypeHandlerFactory _typeHandlerFactory = null;
private bool _usePositionalParameters = false;
#endregion
@@ -68,7 +69,7 @@
internal DynamicSql(ConfigurationScope configScope, IStatement
statement)
{
_statement = statement;
- _configScope = configScope;
+ _typeHandlerFactory = configScope.TypeHandlerFactory;
_usePositionalParameters =
configScope.DataSource.Provider.UsePositionalParameters;
}
#endregion
@@ -99,7 +100,7 @@
public RequestScope GetRequestScope(object parameterObject,
IDalSession session)
{
RequestScope request = new RequestScope();
- _paramParser = new InlineParameterMapParser(
_configScope );
+ _paramParser = new InlineParameterMapParser(
request.ErrorContext );
request.ResultMap = _statement.ResultMap;
string sqlStatement = Process(request, parameterObject);
@@ -141,7 +142,7 @@
// Processes $substitutions$ after DynamicSql
if ( SimpleDynamicSql.IsSimpleDynamicSql(dynSql) )
{
- dynSql = new
SimpleDynamicSql(_configScope.TypeHandlerFactory, dynSql,
_statement).GetSql(parameterObject);
+ dynSql = new
SimpleDynamicSql(_typeHandlerFactory, dynSql,
_statement).GetSql(parameterObject);
}
return dynSql;
}
@@ -248,7 +249,7 @@
if
(handler.IsPostParseRequired)
{
-
SqlText sqlText =
_paramParser.ParseInlineParameterMap(_configScope.TypeHandlerFactory, null,
body.ToString() );
+
SqlText sqlText = _paramParser.ParseInlineParameterMap(_typeHandlerFactory,
null, body.ToString() );
buffer.Append(sqlText.Text);
ParameterProperty[] mappings = sqlText.Parameters;
if (mappings != null)
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements/Statement.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements/Statement.cs?rev=332815&r1=332814&r2=332815&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements/Statement.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/Configuration/Statements/Statement.cs
Sat Nov 12 10:58:20 2005
@@ -25,23 +25,19 @@
#endregion
#region Using
+
using System;
-using System.Data;
using System.Collections;
+using System.Data;
using System.Xml.Serialization;
-using System.Reflection;
-
-using IBatisNet.Common.Exceptions;
using IBatisNet.Common.Utilities.TypesResolver;
-
-using IBatisNet.DataMapper.Configuration.Alias;
-using IBatisNet.DataMapper.TypeHandlers;
-using IBatisNet.DataMapper.Configuration.ResultMapping;
-using IBatisNet.DataMapper.Configuration.ParameterMapping;
using IBatisNet.DataMapper.Configuration.Cache;
+using IBatisNet.DataMapper.Configuration.ParameterMapping;
+using IBatisNet.DataMapper.Configuration.ResultMapping;
using IBatisNet.DataMapper.Configuration.Sql;
using IBatisNet.DataMapper.Exceptions;
using IBatisNet.DataMapper.Scope;
+
#endregion
namespace IBatisNet.DataMapper.Configuration.Statements
@@ -53,9 +49,6 @@
[XmlRoot("statement", Namespace="http://ibatis.apache.org/mapping")]
public class Statement : IStatement
{
- #region Constants
- private const string DOT = ".";
- #endregion
#region Fields
@@ -134,7 +127,7 @@
/// <summary>
/// Tell us if a cacheModel is attached to this statement.
/// </summary>
- [XmlIgnoreAttribute]
+ [XmlIgnore]
public bool HasCacheModel
{
get{ return _cacheModelName.Length >0;}
@@ -143,7 +136,7 @@
/// <summary>
/// The CacheModel used by this statement.
/// </summary>
- [XmlIgnoreAttribute]
+ [XmlIgnore]
public CacheModel CacheModel
{
get { return _cacheModel; }
@@ -164,7 +157,7 @@
/// <summary>
/// The list class type to use for strongly typed collection.
/// </summary>
- [XmlIgnoreAttribute]
+ [XmlIgnore]
public Type ListClass
{
get { return _listClass; }
@@ -183,7 +176,7 @@
/// <summary>
/// The result class type to used.
/// </summary>
- [XmlIgnoreAttribute]
+ [XmlIgnore]
public Type ResultClass
{
get { return _resultClass; }
@@ -202,7 +195,7 @@
/// <summary>
/// The parameter class type to used.
/// </summary>
- [XmlIgnoreAttribute]
+ [XmlIgnore]
public Type ParameterClass
{
get { return _parameterClass; }
@@ -228,7 +221,7 @@
/// <summary>
/// The sql statement
/// </summary>
- [XmlIgnoreAttribute]
+ [XmlIgnore]
public ISql Sql
{
get { return _sql; }
@@ -265,7 +258,7 @@
/// <summary>
/// The ResultMap used by the statement.
/// </summary>
- [XmlIgnoreAttribute]
+ [XmlIgnore]
public ResultMap ResultMap
{
get { return _resultMap; }
@@ -274,7 +267,7 @@
/// <summary>
/// The parameterMap used by the statement.
/// </summary>
- [XmlIgnoreAttribute]
+ [XmlIgnore]
public ParameterMap ParameterMap
{
get { return _parameterMap; }
@@ -286,7 +279,7 @@
/// Default Text.
/// </summary>
/// <example>Text or StoredProcedure</example>
- [XmlIgnoreAttribute]
+ [XmlIgnore]
public virtual CommandType CommandType
{
get { return CommandType.Text; }
@@ -317,15 +310,15 @@
}
if (_resultClassName != string.Empty )
{
- _resultClass =
configurationScope.SqlMapper.GetType(_resultClassName);
+ _resultClass =
configurationScope.SqlMapper.TypeHandlerFactory.GetType(_resultClassName);
}
if (_parameterClassName != string.Empty )
{
- _parameterClass =
configurationScope.SqlMapper.GetType(_parameterClassName);
+ _parameterClass =
configurationScope.SqlMapper.TypeHandlerFactory.GetType(_parameterClassName);
}
if (_listClassName != string.Empty )
{
- _listClass =
configurationScope.SqlMapper.GetType(_listClassName);
+ _listClass =
configurationScope.SqlMapper.TypeHandlerFactory.GetType(_listClassName);
}
}
Modified: ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs?rev=332815&r1=332814&r2=332815&view=diff
==============================================================================
--- ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs (original)
+++ ibatis/trunk/cs/mapper/IBatisNet.DataMapper/SqlMapper.cs Sat Nov 12
10:58:20 2005
@@ -36,7 +36,6 @@
using IBatisNet.Common;
using IBatisNet.Common.Utilities;
using IBatisNet.DataMapper.Configuration;
-using IBatisNet.DataMapper.Configuration.Alias;
using IBatisNet.DataMapper.Configuration.Cache;
using IBatisNet.DataMapper.Configuration.ParameterMapping;
using IBatisNet.DataMapper.Configuration.ResultMapping;
@@ -79,8 +78,6 @@
private HybridDictionary _parameterMaps = new
HybridDictionary();
// DataSource
private DataSource _dataSource = null;
- //(typeAlias name, type alias)
- private HybridDictionary _typeAliasMaps = new
HybridDictionary();
//(CacheModel name, cache))
private HybridDictionary _cacheMaps = new HybridDictionary();
private TypeHandlerFactory _typeHandlerFactory = null;
@@ -1297,60 +1294,10 @@
set { _dataSource = value; }
}
- /// <summary>
- /// Gets a named TypeAlias from the list of available TypeAlias
- /// </summary>
- /// <param name="name">The name of the TypeAlias.</param>
- /// <returns>The TypeAlias.</returns>
- internal TypeAlias GetTypeAlias(string name)
- {
- if (_typeAliasMaps.Contains(name) == true)
- {
- return (TypeAlias) _typeAliasMaps[name];
- }
- else
- {
- return null;
- }
- }
-
- /// <summary>
- /// Adds a named TypeAlias to the list of available TypeAlias.
- /// </summary>
- /// <param name="key">The key name.</param>
- /// <param name="typeAlias"> The TypeAlias.</param>
- internal void AddTypeAlias(string key, TypeAlias typeAlias)
- {
- if (_typeAliasMaps.Contains(key) == true)
- {
- throw new DataMapperException(" Alias name
conflict occurred. The type alias '" + key + "' is already mapped to the value
'"+typeAlias.ClassName+"'.");
- }
- _typeAliasMaps.Add(key, typeAlias);
- }
-
+
- /// <summary>
- /// Gets the type object from the specific class name.
- /// </summary>
- /// <param name="className">The supplied class name.</param>
- /// <returns>The correpsonding type.
- /// </returns>
- internal Type GetType(string className)
- {
- Type type = null;
- TypeAlias typeAlias = this.GetTypeAlias(className) as
TypeAlias;
- if (typeAlias != null)
- {
- type = typeAlias.Class;
- }
- else
- {
- type = Resources.TypeForName(className);
- }
- return type;
- }
/// <summary>
/// Flushes all cached objects that belong to this SqlMap
Modified:
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TypeHandlerFactory.cs
URL:
http://svn.apache.org/viewcvs/ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TypeHandlerFactory.cs?rev=332815&r1=332814&r2=332815&view=diff
==============================================================================
---
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TypeHandlerFactory.cs
(original)
+++
ibatis/trunk/cs/mapper/IBatisNet.DataMapper/TypeHandlers/TypeHandlerFactory.cs
Sat Nov 12 10:58:20 2005
@@ -27,9 +27,13 @@
#region Using
using System;
+using System.Collections;
using System.Collections.Specialized;
using System.Reflection;
using IBatisNet.Common.Logging;
+using IBatisNet.Common.Utilities;
+using IBatisNet.DataMapper.Configuration.Alias;
+using IBatisNet.DataMapper.Exceptions;
#endregion
@@ -44,10 +48,11 @@
#region Fields
private static readonly ILog _logger = LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType );
- private HybridDictionary _typeHandlerMap = new
HybridDictionary();
+ private IDictionary _typeHandlerMap = new HybridDictionary();
private ITypeHandler _unknownTypeHandler = null;
private const string NULL = "_NULL_TYPE_";
-
+ //(typeAlias name, type alias)
+ private IDictionary _typeAliasMaps = new HybridDictionary();
#endregion
#region Constructor
@@ -264,5 +269,59 @@
}
#endregion
+
+ /// <summary>
+ /// Gets a named TypeAlias from the list of available TypeAlias
+ /// </summary>
+ /// <param name="name">The name of the TypeAlias.</param>
+ /// <returns>The TypeAlias.</returns>
+ internal TypeAlias GetTypeAlias(string name)
+ {
+ if (_typeAliasMaps.Contains(name) == true)
+ {
+ return (TypeAlias) _typeAliasMaps[name];
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /// <summary>
+ /// Gets the type object from the specific class name.
+ /// </summary>
+ /// <param name="className">The supplied class name.</param>
+ /// <returns>The correpsonding type.
+ /// </returns>
+ internal Type GetType(string className)
+ {
+ Type type = null;
+ TypeAlias typeAlias = this.GetTypeAlias(className) as
TypeAlias;
+
+ if (typeAlias != null)
+ {
+ type = typeAlias.Class;
+ }
+ else
+ {
+ type = Resources.TypeForName(className);
+ }
+
+ return type;
+ }
+
+ /// <summary>
+ /// Adds a named TypeAlias to the list of available TypeAlias.
+ /// </summary>
+ /// <param name="key">The key name.</param>
+ /// <param name="typeAlias"> The TypeAlias.</param>
+ internal void AddTypeAlias(string key, TypeAlias typeAlias)
+ {
+ if (_typeAliasMaps.Contains(key) == true)
+ {
+ throw new DataMapperException(" Alias name
conflict occurred. The type alias '" + key + "' is already mapped to the value
'"+typeAlias.ClassName+"'.");
+ }
+ _typeAliasMaps.Add(key, typeAlias);
+ }
}
}