I have come upon a bit of code that looks like this (it is based of Dapper tutorial):
await using var con = new SqlConnection("some connection");
if (CancellationToken.IsCancellationRequested) await con.OpenAsync(CancellationToken);
return await con.QueryAsync(query, parameters);
How I am understanding this is if Cancellation token was set then it will open an async connection with that token. However if it is not set then it will not try to open a connection and instead it will just call the query statement.
What I'm trying to understand is if you don't call con.OpenAsync will con.QueryAsync call it? Essentially do I need to explicitly call it if there is no cancellation token?