Skip to content

Commit b9c1312

Browse files
committed
Code Quality - Dispose implementation update
1 parent 8bea48e commit b9c1312

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

QueryDB/Connection/Database/MySqlDBConnection.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace QueryDB.Connection.Database
66
/// <summary>
77
/// 'MySQL' database connection.
88
/// </summary>
9-
internal class MySqlDBConnection : IDisposable
9+
internal sealed class MySqlDBConnection : IDisposable
1010
{
1111
/// <summary>
1212
/// Holds 'MySQL' connection.
@@ -28,8 +28,10 @@ internal MySqlDBConnection(string connectionString)
2828
public void Dispose()
2929
{
3030
if (MySqlConnection != null)
31+
{
32+
MySqlConnection.Close();
3133
MySqlConnection.Dispose();
34+
}
3235
}
33-
3436
}
3537
}

QueryDB/Connection/Database/OracleDBConnection.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace QueryDB.Connection.Database
66
/// <summary>
77
/// 'Oracle' database connection.
88
/// </summary>
9-
internal class OracleDBConnection : IDisposable
9+
internal sealed class OracleDBConnection : IDisposable
1010
{
1111
/// <summary>
1212
/// Holds 'Oracle' connection.
@@ -28,7 +28,10 @@ internal OracleDBConnection(string connectionString)
2828
public void Dispose()
2929
{
3030
if (OracleConnection != null)
31+
{
32+
OracleConnection.Clone();
3133
OracleConnection.Dispose();
34+
}
3235
}
3336
}
3437
}

QueryDB/Connection/Database/SqlDBConnection.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace QueryDB.Connection.Database
66
/// <summary>
77
/// 'Sql Server' database connection.
88
/// </summary>
9-
internal class SqlDBConnection : IDisposable
9+
internal sealed class SqlDBConnection : IDisposable
1010
{
1111
/// <summary>
1212
/// Holds 'Sql Server' connection.
@@ -28,7 +28,10 @@ internal SqlDBConnection(string connectionString)
2828
public void Dispose()
2929
{
3030
if (SqlConnection != null)
31+
{
32+
SqlConnection.Close();
3133
SqlConnection.Dispose();
34+
}
3235
}
3336
}
3437
}

0 commit comments

Comments
 (0)