Changeset d9d8922c8e68…
Parent 4261f27a88a2…
by
Changes to 2 files · Browse files at d9d8922c8e68 Showing diff from parent 4261f27a88a2 Diff from another changeset...
@@ -563,6 +563,7 @@ {
// initialize Migration variables injected from the Migrator
migration.TransformationProvider = _provider;
+ _provider.Timeout = null; // reset the Timeout to the default value
migration.Databases = this._additionalProviders;
migration.Parameters = this._parameters;
return migration;
|
|
|
@@ -39,17 +39,15 @@ private ILogger _logger = new NullLogger();
protected IDbConnection _connection;
private IDbTransaction _transaction;
- private String _assemblyId = null;
- private Boolean _cacheConvertedValues = true;
+ private string _assemblyId = null;
+ private bool _cacheConvertedValues = true;
+ private int? _timeout = null;
public delegate U ConvertColumnDelegate<T, U>(T currentValue, IDataReader row);
#region Properties
public String AssemblyId
{
- get
- {
- return this._assemblyId;
- }
+ get { return this._assemblyId; }
}
/// <summary>
@@ -74,18 +72,19 @@ get { return _logger; }
set { _logger = value; }
}
- #endregion
public string ConnectionString
{
- get
- {
- if (_connection != null)
- return (string)_connection.ConnectionString.Clone();
- return null;
- }
+ get { return _connection != null ? (string)_connection.ConnectionString.Clone() : null; }
}
+ public int? Timeout
+ {
+ get { return this._timeout == null || this._timeout == 0 ? null : this._timeout; }
+ set { this._timeout = value; }
+ }
+ #endregion
+
#region Add Column/Table/PK/FK/Constraint
/// <summary>
/// Add a new column to an existing table.
@@ -123,7 +122,7 @@
/// <summary>
/// <see cref="TransformationProvider.AddColumn(string, string, Type, int, ColumnProperties, object)">
- /// AddColumn(string, string, Type, int, ColumnProperties, object)
+ /// AddColumn(string, string, Type, int, ColumnProperties)
/// </see>
/// </summary>
public virtual void AddColumn(string table, string column, Type type, ColumnProperties property)
@@ -133,7 +132,7 @@
/// <summary>
/// <see cref="TransformationProvider.AddColumn(string, string, Type, int, ColumnProperties, object)">
- /// AddColumn(string, string, Type, int, ColumnProperties, object)
+ /// AddColumn(string, string, Type, int, ColumnProperties)
/// </see>
/// </summary>
public virtual void AddColumn(string table, string column, Type type, int size, ColumnProperties property)
@@ -142,6 +141,53 @@ }
/// <summary>
+ /// <see cref="TransformationProvider.AddColumn(string, string, Type, int, ColumnProperties, object)">
+ /// AddColumn(string, string, Type, int, ColumnProperties, object)
+ /// </see>
+ /// </summary>
+ public virtual void AddColumn(string table, string column, Type type, ColumnProperties property, object defaultValue)
+ {
+ AddColumn(table, column, type, 0, property, defaultValue);
+ }
+
+ /// <summary>
+ /// Implements 'Alter Table' functionality common in most SQL variants.
+ /// </summary>
+ /// <param name="table">Table Name</param>
+ /// <param name="column">Column Name to alter</param>
+ /// <param name="dataType">new typw of the Column</param>
+ /// <param name="size">new size of the Column</param>
+ /// <param name="props">New Column Properties</param>
+ /// <param name="defaultValue">new Default Value</param>
+ public abstract void AlterColumn(string table, string column, Type type, int size);
+
+ /// <summary>
+ /// Implements 'Alter Table' functionality common in most SQL variants.
+ /// </summary>
+ /// <remarks>Transformation providers that dont support all possible functionality are free to work around the problem OR throw an exception.
+ /// If an exception is thrown please include the specific functionality that isnt implemented in the exception message. E.g. SqlLite cant alter columns to be primary keys.</remarks>
+ /// <param name="table">Table Name</param>
+ /// <param name="column">Column Name to alter</param>
+ /// <param name="dataType">new typw of the Column</param>
+ /// <param name="size">new size of the Column</param>
+ /// <param name="props">New Column Properties</param>
+ /// <param name="defaultValue">new Default Value</param>
+ public abstract void AlterColumn(string table, string column, Type dataType, int size, ColumnProperties props, object defaultValue);
+
+ /// <summary>
+ /// Implements 'Alter Table' functionality common in most SQL variants.
+ /// </summary>
+ /// <param name="table">Table Name</param>
+ /// <param name="column">Column Name to alter</param>
+ /// <param name="dataType">new type of the Column</param>
+ /// <param name="props">New Column Properties</param>
+ /// <param name="defaultValue">new Default Value</param>
+ public virtual void AlterColumn(string table, string column, Type dataType, ColumnProperties props, object defaultValue)
+ {
+ AlterColumn(table, column, dataType, 0, props, defaultValue);
+ }
+
+ /// <summary>
/// Append a primary key to a table.
/// </summary>
/// <param name="name">Constraint name</param>
@@ -166,15 +212,6 @@ public abstract void AddTable(string name, params Column[] columns);
/// <summary>
- /// Alter the definition of a column
- /// </summary>
- /// <param name="table"></param>
- /// <param name="column"></param>
- /// <param name="type"></param>
- /// <param name="size"></param>
- public abstract void AlterColumn(string table, string column, Type type, int size);
-
- /// <summary>
/// Append a foreign key (relation) between two tables.
/// </summary>
/// <param name="name">Constraint name</param>
@@ -266,6 +303,8 @@ IDbCommand cmd = _connection.CreateCommand();
cmd.CommandText = sql;
cmd.CommandType = CommandType.Text;
+ if (this.Timeout != null)
+ cmd.CommandTimeout = this.Timeout.Value;
BeginTransaction();
if (_transaction != null)
{
@@ -543,15 +582,6 @@
#region Remove Column/Table/Constraint/FK
/// <summary>
- /// Implements 'Alter Table' functionality common in most SQL variants.
- /// </summary>
- /// <remarks>Transformation providers that dont support all possible functionality are free to work around the problem OR throw an exception.
- /// If an exception is thrown please include the specific functionality that isnt implemented in the exception message. E.g. SqlLite cant alter columns to be primary keys.</remarks>
- /// <param name="table"></param>
- /// <param name="column"></param>
- public abstract void AlterColumn(string table, string column, Type dataType, int size, ColumnProperties props, object defaultValue);
-
- /// <summary>
/// Removes a column from a table
/// </summary>
/// <param name="table">table containing the column</param>
@@ -642,8 +672,7 @@ {
return ExecuteNonQuery(string.Format("UPDATE {0} SET {1}", table, string.Join(", ", columnValues)));
}
-
-
+
protected virtual bool VersionRecordExists(String assemblyId)
{
int? ver = (int?)ExecuteScalar(String.Format("SELECT TOP 1 Version FROM SchemaInfo WHERE AssemblyId='{0}'", assemblyId));
|
Loading...