Changeset 7254b0d001c6…
Parent dd6c1da26dec…
by
Changes to 2 files · Browse files at 7254b0d001c6 Showing diff from parent dd6c1da26dec Diff from another changeset...
@@ -39,6 +39,7 @@ <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <DocumentationFile>bin\Migrator\Release\Migrator.XML</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
|
@@ -30,7 +30,7 @@ /// Base class for every transformation providers.
/// A 'tranformation' is an operation that modifies the database.
/// </summary>
- public abstract class TransformationProvider
+ public abstract class TransformationProvider : IDisposable
{
private const string SCHEMA_INFO_TABLE = "SchemaInfo";
private const string VERSION_COLUMN = "Version";
@@ -390,8 +390,10 @@ public int ExecuteNonQuery(string sql)
{
this.Logger.Trace(sql);
- IDbCommand cmd = BuildCommand(sql);
- return cmd.ExecuteNonQuery();
+ using (IDbCommand cmd = BuildCommand(sql))
+ {
+ return cmd.ExecuteNonQuery();
+ }
}
/// <param name="format">Format String</param>
@@ -601,5 +603,17 @@ int? ver = (int?)ExecuteScalar(String.Format("SELECT TOP 1 Version FROM SchemaInfo WHERE AssemblyId='{0}'", assemblyId));
return ver != null;
}
+
+ #region IDisposable Members
+
+ public virtual void Dispose()
+ {
+ if (this.Connection != null)
+ {
+ this.Connection.Dispose();
+ }
+ }
+
+ #endregion
}
}
|
Loading...