From f38a08b1cfaa2d7b3e923ba24391da2603867f83 Mon Sep 17 00:00:00 2001 From: MattMo Date: Wed, 22 Feb 2023 10:32:15 -0800 Subject: [PATCH] Exposed ExecuteReader and ExecuteNonQuery bumped package version, added documentation. --- MySqlPlus/MySqlManagedConnection.cs | 22 +++++++++++----------- MySqlPlus/MySqlPlus.csproj | 2 +- MySqlPlus/MySqlSession.cs | 27 +++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/MySqlPlus/MySqlManagedConnection.cs b/MySqlPlus/MySqlManagedConnection.cs index 2907369..c40cb68 100644 --- a/MySqlPlus/MySqlManagedConnection.cs +++ b/MySqlPlus/MySqlManagedConnection.cs @@ -147,13 +147,13 @@ namespace MontoyaTech.MySqlPlus } /// - /// Executes a data reader for a command and retrys + /// Executes a data reader for a command and retrys if the database goes away or glitches. /// - /// - /// - /// - /// - /// + /// The MySqlCommand to execute. + /// The max number of times to retry, default is 5. + /// Whether or not to backoff longer each fail, default is true. + /// Whether or not to retry if the command fails, default is true. + /// The MySqlDataReader from running the command. public MySqlDataReader ExecuteReader(MySqlCommand command, int maxRetrys = 5, bool exponentialBackoff = true, bool retry = true) { if (command == null) @@ -223,12 +223,12 @@ namespace MontoyaTech.MySqlPlus } /// - /// Executes a non query command. + /// Executes a non query command and retrys if the database goes away or glitches. /// - /// - /// - /// - /// + /// The MySqlCommand to execute. + /// The max number of times to retry, default is 5. + /// Whether or not to backoff longer each fail, default is true. + /// Whether or not to retry if the command fails, default is true. /// The number of rows affected. /// public int ExecuteNonQuery(MySqlCommand command, int maxRetrys = 5, bool exponentialBackoff = true, bool retry = true) diff --git a/MySqlPlus/MySqlPlus.csproj b/MySqlPlus/MySqlPlus.csproj index 3dd6716..4681963 100644 --- a/MySqlPlus/MySqlPlus.csproj +++ b/MySqlPlus/MySqlPlus.csproj @@ -7,7 +7,7 @@ MontoyaTech.MySqlPlus MontoyaTech.MySqlPlus MontoyaTech.MySqlPlus - 1.1.0 + 1.1.1 MontoyaTech A simple C# library to help work with MySql. MontoyaTech 2023 diff --git a/MySqlPlus/MySqlSession.cs b/MySqlPlus/MySqlSession.cs index 2bbe0bf..1022d5f 100644 --- a/MySqlPlus/MySqlSession.cs +++ b/MySqlPlus/MySqlSession.cs @@ -247,6 +247,33 @@ namespace MontoyaTech.MySqlPlus } } + /// + /// Executes a data reader for a command and retrys if the database goes away or glitches. + /// + /// The MySqlCommand to execute. + /// The max number of times to retry, default is 5. + /// Whether or not to backoff longer each fail, default is true. + /// Whether or not to retry if the command fails, default is true. + /// The MySqlDataReader from running the command. + public MySqlDataReader ExecuteReader(MySqlCommand command, int maxRetrys = 5, bool exponentialBackoff = true, bool retry = true) + { + return this.Connection.ExecuteReader(command, maxRetrys, exponentialBackoff, retry); + } + + /// + /// Executes a non query command and retrys if the database goes away or glitches. + /// + /// The MySqlCommand to execute. + /// The max number of times to retry, default is 5. + /// Whether or not to backoff longer each fail, default is true. + /// Whether or not to retry if the command fails, default is true. + /// The number of rows affected. + /// + public int ExecuteNonQuery(MySqlCommand command, int maxRetrys = 5, bool exponentialBackoff = true, bool retry = true) + { + return this.Connection.ExecuteNonQuery(command, maxRetrys, exponentialBackoff, retry); + } + /// /// Implicitly converts a MySqlSession to a MySqlConnection. ///