I have the feeling I’m missing something obvious, but I can’t quite put my finger on it.
public async Task Delete(Guid id) { using (var db = _connectionFactory()) { try { await db.QueryAsync("DELETE FROM ...", new { id}).ConfigureAwait(false); } catch (Exception exception) { Console.WriteLine(exception); throw; } } }
So when this piece of code gets executed, I get the exception:
System.InvalidOperationException: No columns were selected
Even though I don’t need anything back from my call. I just want to know whether or not my DELETE query has succeeded. The strange part is that the query does get executed. The relevant record is deleted.
Advertisement
Answer
As I suspected. It was something stupid. Solution:
await db.ExecuteAsync("DELETE FROM ...", new { id}).ConfigureAwait(false);