Skip to content

Commit a2b77ca

Browse files
committed
Additional tweaks to new System.Data async APIs
* Fixes to PrepareAsync * Made cancellation token description more consistent and added note where default values are present. * Changed default value for cancellation tokens to be CancellationToken.None instead of null
1 parent a464a88 commit a2b77ca

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

xml/System.Data.Common/DbCommand.xml

+7-7
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@
732732
</Parameters>
733733
<Docs>
734734
<param name="behavior">Options for statement execution and data retrieval.</param>
735-
<param name="cancellationToken">The token to monitor for cancellation requests.</param>
735+
<param name="cancellationToken">A token to cancel the asynchronous operation.</param>
736736
<summary>Providers should implement this method to provide a non-default implementation for <see cref="Overload:System.Data.Common.DbCommand.ExecuteReader" /> overloads.
737737

738738
The default implementation invokes the synchronous <see cref="M:System.Data.Common.DbCommand.ExecuteReader" /> method and returns a completed task, blocking the calling thread. The default implementation will return a cancelled task if passed an already cancelled cancellation token. Exceptions thrown by ExecuteReader will be communicated via the returned Task Exception property.
@@ -898,7 +898,7 @@
898898
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" Index="0" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
899899
</Parameters>
900900
<Docs>
901-
<param name="cancellationToken">The token to monitor for cancellation requests.</param>
901+
<param name="cancellationToken">A token to cancel the asynchronous operation.</param>
902902
<summary>This is the asynchronous version of <see cref="M:System.Data.Common.DbCommand.ExecuteNonQuery" />. Providers should override with an appropriate implementation. The cancellation token may optionally be ignored.
903903

904904
The default implementation invokes the synchronous <see cref="M:System.Data.Common.DbCommand.ExecuteNonQuery" /> method and returns a completed task, blocking the calling thread. The default implementation will return a cancelled task if passed an already cancelled cancellation token. Exceptions thrown by <see cref="M:System.Data.Common.DbCommand.ExecuteNonQuery" /> will be communicated via the returned Task Exception property.
@@ -1151,7 +1151,7 @@
11511151
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" Index="0" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
11521152
</Parameters>
11531153
<Docs>
1154-
<param name="cancellationToken">The token to monitor for cancellation requests.</param>
1154+
<param name="cancellationToken">A token to cancel the asynchronous operation.</param>
11551155
<summary>An asynchronous version of <see cref="Overload:System.Data.Common.DbCommand.ExecuteReader" />, which executes the <see cref="P:System.Data.Common.DbCommand.CommandText" /> against the <see cref="P:System.Data.Common.DbCommand.Connection" /> and returns a <see cref="T:System.Data.Common.DbDataReader" />. This method propagates a notification that operations should be canceled.
11561156

11571157
Invokes <see cref="M:System.Data.Common.DbCommand.ExecuteDbDataReaderAsync(System.Data.CommandBehavior,System.Threading.CancellationToken)" />.</summary>
@@ -1202,7 +1202,7 @@
12021202
</Parameters>
12031203
<Docs>
12041204
<param name="behavior">One of the enumeration values that specifies the command behavior.</param>
1205-
<param name="cancellationToken">The token to monitor for cancellation requests.</param>
1205+
<param name="cancellationToken">A token to cancel the asynchronous operation.</param>
12061206
<summary>Invokes <see cref="M:System.Data.Common.DbCommand.ExecuteDbDataReaderAsync(System.Data.CommandBehavior,System.Threading.CancellationToken)" />.</summary>
12071207
<returns>A task representing the asynchronous operation.</returns>
12081208
<remarks>
@@ -1362,7 +1362,7 @@
13621362
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" Index="0" FrameworkAlternate="dotnet-uwp-10.0;netcore-1.0;netcore-1.1;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netstandard-2.0;netstandard-2.1;xamarinandroid-7.1;xamarinios-10.8;xamarinmac-3.0" />
13631363
</Parameters>
13641364
<Docs>
1365-
<param name="cancellationToken">The token to monitor for cancellation requests.</param>
1365+
<param name="cancellationToken">A token to cancel the asynchronous operation.</param>
13661366
<summary>This is the asynchronous version of <see cref="M:System.Data.Common.DbCommand.ExecuteScalar" />. Providers should override with an appropriate implementation. The cancellation token may optionally be ignored.
13671367

13681368
The default implementation invokes the synchronous <see cref="M:System.Data.Common.DbCommand.ExecuteScalar" /> method and returns a completed task, blocking the calling thread. The default implementation will return a cancelled task if passed an already cancelled cancellation token. Exceptions thrown by ExecuteScalar will be communicated via the returned Task Exception property.
@@ -1495,7 +1495,7 @@
14951495
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" Index="0" FrameworkAlternate="netcore-3.0;netstandard-2.1" />
14961496
</Parameters>
14971497
<Docs>
1498-
<param name="cancellationToken">To be added.</param>
1498+
<param name="cancellationToken">An optional token to cancel the asynchronous operation. The default value is <see cref="CancellationToken.None"/>.</param>
14991499
<summary>Asynchronously creates a prepared (or compiled) version of the command on the data source.</summary>
15001500
<returns>A <see cref="P:System.Threading.Tasks.Task" /> representing the asynchronous operation.</returns>
15011501
<remarks>
@@ -1506,7 +1506,7 @@
15061506
15071507
Data providers that support [asynchronous programming](~/docs/framework/data/adonet/asynchronous-programming.md) should override the default implementation using asynchronous I/O operations.
15081508
1509-
If the <xref:System.Data.Common.DbCommand.CommandType%2A> property is set to `TableDirect`, `Prepare` does nothing. If <xref:System.Data.Common.DbCommand.CommandType%2A> is set to `StoredProcedure`, the call to `Prepare` should succeed, although it may result in a no-op.
1509+
If the <xref:System.Data.Common.DbCommand.CommandType%2A> property is set to `TableDirect`, `PrepareAsync` does nothing. If <xref:System.Data.Common.DbCommand.CommandType%2A> is set to `StoredProcedure`, the call to `PrepareAsync` should succeed, although it may result in a no-op.
15101510
15111511
]]></format>
15121512
</remarks>

xml/System.Data.Common/DbConnection.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@
294294
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" Index="0" FrameworkAlternate="netcore-3.0;netstandard-2.1" />
295295
</Parameters>
296296
<Docs>
297-
<param name="cancellationToken">A token to cancel the asynchronous operation.</param>
297+
<param name="cancellationToken">An optional token to cancel the asynchronous operation. The default value is <see cref="CancellationToken.None"/>.</param>
298298
<summary>Asynchronously begins a database transaction.</summary>
299299
<returns>A task whose <see cref="P:System.Threading.Tasks.Task`1.Result" /> property is an object representing the new transaction.</returns>
300300
<remarks>
@@ -337,7 +337,7 @@
337337
</Parameters>
338338
<Docs>
339339
<param name="isolationLevel">One of the enumeration values that specifies the isolation level for the transaction to use.</param>
340-
<param name="cancellationToken">A token to cancel the asynchronous operation.</param>
340+
<param name="cancellationToken">An optional token to cancel the asynchronous operation. The default value is <see cref="CancellationToken.None"/>.</param>
341341
<summary>Asynchronously begins a database transaction.</summary>
342342
<returns>A task whose <see cref="P:System.Threading.Tasks.Task`1.Result" /> property is an object representing the new transaction.</returns>
343343
<remarks>
@@ -427,7 +427,7 @@
427427
</Parameters>
428428
<Docs>
429429
<param name="databaseName">The name of the database for the connection to use.</param>
430-
<param name="cancellationToken">A token to cancel the asynchronous operation.</param>
430+
<param name="cancellationToken">An optional token to cancel the asynchronous operation. The default value is <see cref="CancellationToken.None"/>.</param>
431431
<summary>Asynchronously changes the current database for an open connection.</summary>
432432
<returns>A task representing the asynchronous operation.</returns>
433433
<remarks>

xml/System.Data.Common/DbTransaction.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" Index="0" FrameworkAlternate="netcore-3.0;netstandard-2.1" />
139139
</Parameters>
140140
<Docs>
141-
<param name="cancellationToken">A token to cancel the asynchronous operation.</param>
141+
<param name="cancellationToken">An optional token to cancel the asynchronous operation. The default value is <see cref="CancellationToken.None"/>.</param>
142142
<summary>Asynchronously commits the database transaction.</summary>
143143
<returns>A <see cref="P:System.Threading.Tasks.Task" /> representing the asynchronous operation.</returns>
144144
<remarks>
@@ -499,7 +499,7 @@
499499
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" Index="0" FrameworkAlternate="netcore-3.0;netstandard-2.1" />
500500
</Parameters>
501501
<Docs>
502-
<param name="cancellationToken">A token to cancel the asynchronous operation.</param>
502+
<param name="cancellationToken">An optional token to cancel the asynchronous operation. The default value is <see cref="CancellationToken.None"/>.</param>
503503
<summary>Asynchronously rolls back a transaction from a pending state.</summary>
504504
<returns>A task representing the asynchronous operation.</returns>
505505
<remarks>

0 commit comments

Comments
 (0)