Changeset a29032a10991…
Parent bae170f0e9c5…
by
Changes to 2 files · Browse files at a29032a10991 Showing diff from parent bae170f0e9c5 Diff from another changeset...
@@ -14,6 +14,7 @@ using System.Data.SqlClient;
using System.Text;
using System.Globalization;
+using System.Collections.Generic;
namespace Migrator.Providers
{
@@ -253,9 +254,11 @@ {
if (!(reader[column] is DBNull))
{
- U value = convertFunc.Invoke((T)reader[column], reader);
- if (!data.Contains(reader[column]))
- data.Add(reader[column], value);
+ if (!this.CacheConvertedValues || !data.Contains(reader[column]))
+ {
+ U value = convertFunc.Invoke((T)reader[column], reader);
+ data[reader[column]] = value;
+ }
}
}
}
|
@@ -40,7 +40,7 @@ protected IDbConnection _connection;
private IDbTransaction _transaction;
private String _assemblyId = null;
-
+ private Boolean _cacheConvertedValues = true;
public delegate U ConvertColumnDelegate<T, U>(T currentValue, IDataReader row);
#region Properties
@@ -52,6 +52,15 @@ }
}
+ /// <summary>
+ /// States weither to cache a conversion value or to invoke the conversion function every time. Defaults to cached.
+ /// </summary>
+ public Boolean CacheConvertedValues
+ {
+ get { return _cacheConvertedValues; }
+ set { _cacheConvertedValues = value; }
+ }
+
public IDbConnection Connection
{
get { return _connection; }
@@ -462,6 +471,7 @@ public int ParameterizedNonQuery(string commandText, Dictionary<String, Object> parameters)
{
IDbCommand cmd = BuildCommand(commandText);
+ cmd.Prepare();
foreach (String key in parameters.Keys)
{
Object value = parameters[key];
|
Loading...