Example #1
0
 public async Task DoAnotherCoolThing()
 {
     var sqlConnection = new SqlConnection();
     var sqlCommand = new SqlCommand();
     try
     {
         await sqlConnection.OpenAsync();
         sqlCommand.Connection = sqlConnection;
         await sqlCommand.ExecuteNonQueryAsync();
     }
     catch (Exception ex)
     {
         await _logger.LogAsync(ex);
     }
     finally
     {
         if (sqlConnection.State != ConnectionState.Closed)
             await sqlConnection.CloseAsync();
     }
 }