Skip to content

Commit b7fe6ec

Browse files
committed
Code Quality - Methods and properties that don't access instance data should be static
1 parent 1b5f355 commit b7fe6ec

File tree

5 files changed

+8
-12
lines changed

5 files changed

+8
-12
lines changed

QueryDB/DBContext.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,32 +210,28 @@ public bool ExecuteTransaction(List<string> sqlStatements)
210210
{
211211
using (var msSqlDBConnection = GetSqlServerConnection())
212212
{
213-
var _systemAdapter = new MSSQL.Adapter();
214-
return _systemAdapter.ExecuteTransaction(sqlStatements, msSqlDBConnection.SqlConnection);
213+
return MSSQL.Adapter.ExecuteTransaction(sqlStatements, msSqlDBConnection.SqlConnection);
215214
}
216215
}
217216
else if (Database.Equals(DB.MySQL))
218217
{
219218
using (var mySqlDBConnection = GetMySqlConnection())
220219
{
221-
var _systemAdapter = new MySQL.Adapter();
222-
return _systemAdapter.ExecuteTransaction(sqlStatements, mySqlDBConnection.MySqlConnection);
220+
return MySQL.Adapter.ExecuteTransaction(sqlStatements, mySqlDBConnection.MySqlConnection);
223221
}
224222
}
225223
else if (Database.Equals(DB.Oracle))
226224
{
227225
using (var oracleDBConnection = GetOracleConnection())
228226
{
229-
var _systemAdapter = new Oracle.Adapter();
230-
return _systemAdapter.ExecuteTransaction(sqlStatements, oracleDBConnection.OracleConnection);
227+
return Oracle.Adapter.ExecuteTransaction(sqlStatements, oracleDBConnection.OracleConnection);
231228
}
232229
}
233230
else if (Database.Equals(DB.PostgreSQL))
234231
{
235232
using (var postgreSqlDBConnection = GetPostgreSqlConnection())
236233
{
237-
var _systemAdapter = new PostgreSQL.Adapter();
238-
return _systemAdapter.ExecuteTransaction(sqlStatements, postgreSqlDBConnection.PostgreSQLConnection);
234+
return PostgreSQL.Adapter.ExecuteTransaction(sqlStatements, postgreSqlDBConnection.PostgreSQLConnection);
239235
}
240236
}
241237
return false;

QueryDB/MSSQL/Adapter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ internal int ExecuteCommand(string sqlStatement, SqlConnection connection)
152152
/// Logs and handles exceptions if any SQL command execution fails.
153153
/// </exception>
154154

155-
internal bool ExecuteTransaction(List<string> sqlStatements, SqlConnection connection)
155+
internal static bool ExecuteTransaction(List<string> sqlStatements, SqlConnection connection)
156156
{
157157
using (SqlTransaction transaction = GetSqlTransaction(connection))
158158
{

QueryDB/MySQL/Adapter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ internal int ExecuteCommand(string sqlStatement, MySqlConnection connection)
151151
/// <exception cref="Exception">
152152
/// Logs and handles exceptions if any SQL command execution fails.
153153
/// </exception>
154-
internal bool ExecuteTransaction(List<string> sqlStatements, MySqlConnection connection)
154+
internal static bool ExecuteTransaction(List<string> sqlStatements, MySqlConnection connection)
155155
{
156156
using (MySqlTransaction transaction = GetMySqlTransaction(connection))
157157
{

QueryDB/Oracle/Adapter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ internal int ExecuteCommand(string sqlStatement, OracleConnection connection)
157157
/// <exception cref="Exception">
158158
/// Logs and handles exceptions if any SQL command execution fails.
159159
/// </exception>
160-
internal bool ExecuteTransaction(List<string> sqlStatements, OracleConnection connection)
160+
internal static bool ExecuteTransaction(List<string> sqlStatements, OracleConnection connection)
161161
{
162162
using (OracleTransaction transaction = GetOracleTransaction(connection))
163163
{

QueryDB/PostgreSQL/Adapter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ internal int ExecuteCommand(string sqlStatement, NpgsqlConnection connection)
151151
/// <exception cref="Exception">
152152
/// Logs and handles exceptions if any SQL command execution fails.
153153
/// </exception>
154-
internal bool ExecuteTransaction(List<string> sqlStatements, NpgsqlConnection connection)
154+
internal static bool ExecuteTransaction(List<string> sqlStatements, NpgsqlConnection connection)
155155
{
156156
using (NpgsqlTransaction transaction = GetPostgreSqlTransaction(connection))
157157
{

0 commit comments

Comments
 (0)