in src/SqlBindingUtilities.cs [419:434]
public static async Task<object> ExecuteScalarAsyncWithLogging(this SqlCommand cmd, ILogger logger, CancellationToken cancellationToken, bool logCommand = false)
{
try
{
if (logCommand)
{
logger.LogDebug($"Executing query={cmd.CommandText}");
}
return await cmd.ExecuteScalarAsync(cancellationToken);
}
catch (Exception e)
{
logger.LogError($"Exception executing query. Message={e.Message}\nQuery={cmd.CommandText}");
throw;
}
}