OpenSource » Database Migrator » Legacy Migrator
Clone URL:  

Migrator Transformation Provider now implements Idisposable

Changeset 7254b0d001c6

Parent dd6c1da26dec

by danielpupek

Changes to 2 files · Browse files at 7254b0d001c6 Showing diff from parent dd6c1da26dec Diff from another changeset...

 
39
40
41
 
42
43
44
 
39
40
41
42
43
44
45
@@ -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
31
32
33
 
34
35
36
 
390
391
392
393
394
 
 
 
 
395
396
397
 
601
602
603
 
 
 
 
 
 
 
 
 
 
 
 
604
605
 
30
31
32
 
33
34
35
36
 
390
391
392
 
 
393
394
395
396
397
398
399
 
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
@@ -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   }  }