/// <summary> /// Validate that the Sql Transaction is not null, and the associated connection is valid/open, etc. /// </summary> /// <param name="sqlTransaction"></param> public static void AssertSqlTransactionIsValid(this SqlTransaction sqlTransaction) { sqlTransaction.AssertNotNull(nameof(sqlTransaction)); if (sqlTransaction?.Connection.State != ConnectionState.Open) { throw new Exception("Sql Connection for the provided Sql Transaction is not open."); } }