data-api-builder icon indicating copy to clipboard operation
data-api-builder copied to clipboard

Optimize the SQL DB query in Health Endpoint

Open sezal98 opened this issue 9 months ago • 0 comments

Try QueryExecutor to optimize the SQL DB query instead of

using (SqlConnection connection = new(connectionString))
            {
                try
                {
                    SqlCommand command = new(query, connection);
                    connection.Open();
                    SqlDataReader reader = command.ExecuteReader();
                    LogTrace("The health check query for datasource executed successfully.");
                    reader.Close();
                }
                catch (Exception ex)
                {
                    LogTrace($"An exception occurred while executing the health check query: {ex.Message}");
                    errorMessage = ex.Message;
                }
            }

sezal98 avatar Mar 27 '25 06:03 sezal98