@@ -54,13 +54,9 @@ should be familiar with [Async/Await - Best Practices in Asynchronous Programmin
54
54
<td>ExecuteScalar</td>
55
55
</tr >
56
56
<tr >
57
- <td rowspan="3 " style="vertical-align:middle">
57
+ <td rowspan="2 " style="vertical-align:middle">
58
58
<a href="https://docs.microsoft.com/en-us/dotnet/core/api/system.data.common.dbdatareader">DbDataReader</a>
59
59
</td>
60
- <td>IsDBNullAsync</td>
61
- <td>IsDBNull</td>
62
- </tr >
63
- <tr >
64
60
<td>NextResultAsync</td>
65
61
<td>NextResult</td>
66
62
</tr >
@@ -88,13 +84,17 @@ should be familiar with [Async/Await - Best Practices in Asynchronous Programmin
88
84
<span class =" text-danger " >* </span >Async Transaction methods are not part of ADO.NET, they are provided by
89
85
MySqlConnector to allow database code to remain fully asynchronous.
90
86
91
- ### Exception : DbDataReader.GetFieldValueAsync
87
+ ### Exceptions : DbDataReader.GetFieldValueAsync and IsDBNullAsync
92
88
93
89
Once ` DbDataReader.ReadAsync ` (or ` DbDataReader.Read ` ) has returned ` true ` , the full contents of the current
94
- row are will be memory. Calling ` GetFieldValue<T> ` will return the value immediately (without blocking on I/O).
90
+ row will be in memory. Calling ` GetFieldValue<T> ` will return the value immediately (without blocking on I/O).
95
91
It will have higher performance than ` GetFieldValueAsync<T> ` because it doesn't have to allocate a ` Task<T> `
96
92
to store the result. There is no performance benefit to using the ` DbDataReader.GetFieldValueAsync<T> ` method.
97
93
94
+ Similarly, prefer to call ` IsDBNull ` instead of ` IsDBNullAsync ` ; the information is already available and
95
+ ` IsDBNull ` can return it immediately. (The async performance penalty isn't quite as bad because ` IsDBNullAsync `
96
+ uses cached ` Task<bool> ` objects for its ` true ` and ` false ` return values.)
97
+
98
98
### Example Console Application
99
99
100
100
In order to get the full benefit of asynchronous operation, every method in the call stack that eventually calls
0 commit comments