Are there any benefits of reading each field async from a SqlDataReader?

After some peeking at reflector, the interesting methods here (GetFieldValueAsync<T>, IsDBNullAsync, and the internal method GetBytesAsync) only do “interesting” code for the CommandBehavior.SequentialAccess scenario. So: if you’re not using that: don’t bother – the row data is already buffered in memory, and Task<T> is pure overhead (although it will at least be an already-completed task result, i.e. Task.FromResult<T> – which is handled efficiently by await, without a context switch).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)