From 10c9e17283f7a4f1cfefcb080f9499461cc31d21 Mon Sep 17 00:00:00 2001
From: DavoudEshtehari <61173489+DavoudEshtehari@users.noreply.github.com>
Date: Tue, 27 Feb 2024 19:41:38 +0000
Subject: [PATCH] Fix | Refine documents for GA v5.2 (#2371)
---
.../Microsoft.Data.Common/DbBatch.xml | 651 ------------------
.../Microsoft.Data.Common/DbBatchCommand.xml | 113 ---
.../DbBatchCommandCollection.xml | 410 -----------
.../Microsoft.Data.SqlClient/SqlBatch.xml | 217 ++++--
.../SqlBatchCommand.xml | 61 +-
.../SqlBatchCommandCollection.xml | 227 ++++--
.../Microsoft.Data.SqlClient/SqlBulkCopy.xml | 2 +-
.../Microsoft.Data.SqlClient/SqlCommand.xml | 4 +-
.../SqlConnection.xml | 24 +-
.../Microsoft.Data.SqlClient/SqlException.xml | 15 +-
.../netcore/ref/Microsoft.Data.SqlClient.cs | 1 -
.../ref/Microsoft.Data.SqlClient.csproj | 2 +-
.../Microsoft/Data/SqlClient/SqlConnection.cs | 4 +-
...crosoft.Data.SqlClient.Batch.NetCoreApp.cs | 24 +-
.../ref/Microsoft.Data.SqlClient.Batch.cs | 110 +--
.../src/Microsoft/Data/SqlClient/SqlBatch.cs | 41 +-
.../Data/SqlClient/SqlBatchCommand.cs | 13 +-
.../SqlClient/SqlBatchCommandCollection.cs | 42 +-
.../Microsoft/Data/SqlClient/SqlException.cs | 2 +-
19 files changed, 525 insertions(+), 1438 deletions(-)
delete mode 100644 doc/snippets/Microsoft.Data.Common/DbBatch.xml
delete mode 100644 doc/snippets/Microsoft.Data.Common/DbBatchCommand.xml
delete mode 100644 doc/snippets/Microsoft.Data.Common/DbBatchCommandCollection.xml
diff --git a/doc/snippets/Microsoft.Data.Common/DbBatch.xml b/doc/snippets/Microsoft.Data.Common/DbBatch.xml
deleted file mode 100644
index 1c9dcdd68b..0000000000
--- a/doc/snippets/Microsoft.Data.Common/DbBatch.xml
+++ /dev/null
@@ -1,651 +0,0 @@
-
-
-
-
-
-
-
-
- System.Object
-
-
-
- System.IAsyncDisposable
-
-
- System.IDisposable
-
-
-
-
- [System.Runtime.CompilerServices.Nullable(0)]
- [<System.Runtime.CompilerServices.Nullable(0)>]
-
-
- [System.Runtime.CompilerServices.NullableContext(1)]
- [<System.Runtime.CompilerServices.NullableContext(1)>]
-
-
-
- Represents a batch of commands which can be executed against a data source in a single round trip. Provides a base class for database-specific classes that represent command batches.
-
-
-
-
-
-
-
-
-
-
- Constructor
-
-
-
- Initializes a new instance of the class.
-
- To be added.
-
-
-
-
-
- Property
-
- System.Data.Common.DbBatchCommandCollection
-
-
-
- Gets the collection of objects.
-
- The commands contained within the batch.
- To be added.
-
-
-
-
-
- Method
-
- System.Void
-
-
-
-
- Attempts to cancel the execution of a .
-
-
-
-
-
-
-
-
-
-
-
- Property
-
-
- [System.Runtime.CompilerServices.Nullable(2)]
- [<System.Runtime.CompilerServices.Nullable(2)>]
-
-
- [get: System.Runtime.CompilerServices.NullableContext(2)]
- [<get: System.Runtime.CompilerServices.NullableContext(2)>]
-
-
- [set: System.Runtime.CompilerServices.NullableContext(2)]
- [<set: System.Runtime.CompilerServices.NullableContext(2)>]
-
-
-
- System.Data.Common.DbConnection
-
-
-
- Gets or sets the used by this .
-
- The connection to the data source.
- To be added.
-
-
-
-
-
- Method
-
- System.Data.Common.DbBatchCommand
-
-
-
-
- Creates a new instance of a object.
-
-
- A object.
-
- To be added.
-
-
-
-
-
- Method
-
- System.Data.Common.DbBatchCommand
-
-
-
-
- When overridden in a derived class, creates a new instance of a object.
-
-
- A object.
-
- To be added.
-
-
-
-
-
- Property
-
- System.Data.Common.DbBatchCommandCollection
-
-
-
- When overridden in a derived class, gets the collection of objects.
-
- The commands contained within the batch.
- To be added.
-
-
-
-
-
- Property
-
-
- [System.Runtime.CompilerServices.Nullable(2)]
- [<System.Runtime.CompilerServices.Nullable(2)>]
-
-
- [get: System.Runtime.CompilerServices.NullableContext(2)]
- [<get: System.Runtime.CompilerServices.NullableContext(2)>]
-
-
- [set: System.Runtime.CompilerServices.NullableContext(2)]
- [<set: System.Runtime.CompilerServices.NullableContext(2)>]
-
-
-
- System.Data.Common.DbConnection
-
-
-
- When overridden in a derived class, gets or sets the used by this .
-
- The connection to the data source.
- To be added.
-
-
-
-
-
- Property
-
-
- [System.Runtime.CompilerServices.Nullable(2)]
- [<System.Runtime.CompilerServices.Nullable(2)>]
-
-
- [get: System.Runtime.CompilerServices.NullableContext(2)]
- [<get: System.Runtime.CompilerServices.NullableContext(2)>]
-
-
- [set: System.Runtime.CompilerServices.NullableContext(2)]
- [<set: System.Runtime.CompilerServices.NullableContext(2)>]
-
-
-
- System.Data.Common.DbTransaction
-
-
-
- When overridden in a derived class, gets or sets the within which this object executes.
-
-
- The transaction within which a batch of a .NET data provider executes. The default value is a null reference ( in Visual Basic).
-
- To be added.
-
-
-
-
-
- Method
-
- M:System.IDisposable.Dispose
-
-
- System.Void
-
-
-
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- To be added.
-
-
-
-
-
- Method
-
- M:System.IAsyncDisposable.DisposeAsync
-
-
- System.Threading.Tasks.ValueTask
-
-
-
- Asynchronously diposes the batch object.
-
- A representing the asynchronous operation.
-
-
-
- , are still thrown synchronously. For the stored exceptions, see the exceptions thrown by .
-
-]]>
-
-
-
-
-
-
-
- Method
-
- System.Data.Common.DbDataReader
-
-
-
-
-
-
- An instance of , specifying options for batch execution and data retrieval.
-
-
- When overridden in a derived class, executes the batch against its connection, returning a which can be used to access the results.
-
-
- A object.
-
-
-
- can be used to advance the reader to the next result set.
-
- ]]>
-
-
- An error occurred while executing the batch.
-
- The value is invalid.
-
-
-
-
-
-
- Method
-
- System.Threading.Tasks.Task<System.Data.Common.DbDataReader>
-
-
-
-
-
-
- One of the enumeration values that specifies options for batch execution and data retrieval.
- A token to cancel the asynchronous operation.
-
- Providers should implement this method to provide a non-default implementation for overloads.
-
- The default implementation invokes the synchronous 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.
-
- This method accepts a cancellation token that can be used to request the operation to be cancelled early. Implementations may ignore this request.
-
- A task representing the asynchronous operation.
-
-
- , are still thrown synchronously. For the stored exceptions, see the exceptions thrown by .
-
-]]>
-
-
-
-
-
-
-
- Method
-
- System.Int32
-
-
-
- Executes the batch against its connection object, returning the total number of rows affected across all the batch commands.
- The total number of rows affected across all the batch commands.
-
-
- to perform catalog operations (for example, querying the structure of a database or creating database objects such as tables), or to change the data in a database by executing UPDATE, INSERT, or DELETE statements.
-
- Although does not return any rows, any output parameters or return values mapped to parameters are populated with data.
-
- For UPDATE, INSERT, and DELETE statements, the return value is the total number of rows affected by the batch. If no UPDATE, INSERT, or DELETE statements are included in the batch, the return value is -1.
-
- ]]>
-
-
-
-
-
-
-
- Method
-
- System.Threading.Tasks.Task<System.Int32>
-
-
-
-
-
- A token to cancel the asynchronous operation.
-
- This is the asynchronous version of . Providers should override with an appropriate implementation. The cancellation token may optionally be ignored.
-
- The default implementation invokes the synchronous 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 will be communicated via the returned Task Exception property.
-
- Do not invoke other methods and properties of the object until the returned Task is complete.
-
- A task representing the asynchronous operation.
-
-
- , are still thrown synchronously. For the stored exceptions, see the exceptions thrown by .
-
-]]>
-
-
- An error occurred while executing the batch.
- ADO.NET Overview
-
-
-
-
-
- Method
-
- System.Data.Common.DbDataReader
-
-
-
-
-
- One of the enumeration values that specifies options for batch execution and data retrieval.
-
- Executes the batch against its connection, returning a which can be used to access the results.
-
-
- A object.
-
-
-
- can be used to advance the reader to the next result set.
-
- ]]>
-
-
-
-
-
-
-
- Method
-
- System.Threading.Tasks.Task<System.Data.Common.DbDataReader>
-
-
-
-
-
- To be added.
-
- An asynchronous version of , which executes the batch against its connection, returning a which can be used to access the results.
-
- A task representing the asynchronous operation.
-
-
- in . For more information about asynchronous programming, see [Asynchronous Programming](/dotnet/framework/data/adonet/asynchronous-programming).
-
- ]]>
-
-
- An error occurred while executing the batch.
-
- The value is invalid.
-
-
-
-
-
-
- Method
-
- System.Threading.Tasks.Task<System.Data.Common.DbDataReader>
-
-
-
-
-
-
- One of the enumeration values that specifies options for batch execution and data retrieval.
- A token to cancel the asynchronous operation.
-
- An asynchronous version of , which executes the batch against its connection, returning a which can be used to access the results.
-
- A task representing the asynchronous operation.
-
-
- in . For more information about asynchronous programming, see [Asynchronous Programming](/dotnet/framework/data/adonet/asynchronous-programming).
-
- This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as , are still thrown synchronously. For the stored exceptions, see the exceptions thrown by .
-
-]]>
-
-
- An error occurred while executing the batch.
-
- The value is invalid.
-
-
-
-
-
-
- Method
-
-
- [System.Runtime.CompilerServices.NullableContext(2)]
- [<System.Runtime.CompilerServices.NullableContext(2)>]
-
-
-
- System.Object
-
-
-
- Executes the batch and returns the first column of the first row in the first returned result set. All other columns, rows and resultsets are ignored.
- The first column of the first row in the first result set.
- To be added.
- An error occurred while executing the batch.
-
-
-
-
-
- Method
-
- System.Threading.Tasks.Task<System.Object>
-
-
-
-
-
- A token to cancel the asynchronous operation.
-
- An asynchronous version of , which executes the batch and returns the first column of the first row in the first returned result set. All other columns, rows and result sets are ignored.
-
- The first column of the first row in the first result set.
-
- This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as , are still thrown synchronously. For the stored exceptions, see the exceptions thrown by .
-
- An error occurred while executing the batch.
-
-
-
-
-
- Method
-
- System.Void
-
-
-
- Creates a prepared (or compiled) version of the batch, or of each of its commands, on the data source.
- To be added.
-
-
-
-
-
- Method
-
- System.Threading.Tasks.Task
-
-
-
-
-
-
- An optional token to cancel the asynchronous operation. The default value is .
-
- Asynchronously creates a prepared (or compiled) version of the batch, or of each of its commands, on the data source.
-
- A representing the asynchronous operation.
-
-
- This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as , are still thrown synchronously. For the stored exceptions, see the exceptions thrown by .
-
-
-
-
-
-
- Property
-
- System.Int32
-
-
- Gets or sets the wait time (in seconds) before terminating the attempt to execute the batch and generating an error.
- The time in seconds to wait for the batch to execute.
-
-
- is generated if the assigned property value is less than 0.
-
- Note to implementers: it's recommended that 0 mean no timeout.
-
- ]]>
-
-
-
-
-
-
-
- Property
-
-
- [System.Runtime.CompilerServices.Nullable(2)]
- [<System.Runtime.CompilerServices.Nullable(2)>]
-
-
- [get: System.Runtime.CompilerServices.NullableContext(2)]
- [<get: System.Runtime.CompilerServices.NullableContext(2)>]
-
-
- [set: System.Runtime.CompilerServices.NullableContext(2)]
- [<set: System.Runtime.CompilerServices.NullableContext(2)>]
-
-
-
- System.Data.Common.DbTransaction
-
-
-
- Gets or sets the within which this object executes.
-
-
- The transaction within which a batch of a .NET data provider executes. The default value is a null reference ( in Visual Basic).
-
- To be added.
-
-
-
-
diff --git a/doc/snippets/Microsoft.Data.Common/DbBatchCommand.xml b/doc/snippets/Microsoft.Data.Common/DbBatchCommand.xml
deleted file mode 100644
index 68efa39676..0000000000
--- a/doc/snippets/Microsoft.Data.Common/DbBatchCommand.xml
+++ /dev/null
@@ -1,113 +0,0 @@
-
-
-
-
- System.Object
-
-
-
-
- [System.Runtime.CompilerServices.Nullable(0)]
- [<System.Runtime.CompilerServices.Nullable(0)>]
-
-
- [System.Runtime.CompilerServices.NullableContext(1)]
- [<System.Runtime.CompilerServices.NullableContext(1)>]
-
-
-
-
- Represents a single command within a . A batch can be executed against a data source in a single round trip.
-
- To be added.
-
-
-
-
-
- Constructor
-
-
-
- Constructs an instance of the object.
-
- To be added.
-
-
-
-
-
- Property
-
- System.String
-
-
- Gets or sets the text command to run against the data source.
- The text command to execute. The default value is an empty string ("").
- To be added.
-
-
-
-
-
- Property
-
- System.Data.CommandType
-
-
-
- Gets or sets how the property is interpreted.
-
-
- One of the enumeration values that specifies how a command string is interpreted. The default is .
-
- To be added.
-
-
-
-
-
- Property
-
- System.Data.Common.DbParameterCollection
-
-
-
- Gets the collection of objects.
-
- The parameters of the SQL statement or stored procedure.
- To be added.
-
-
-
-
-
- Property
-
- System.Data.Common.DbParameterCollection
-
-
-
- Gets the collection of objects. For more information on parameters, see [Configuring Parameters and Parameter Data Types](/dotnet/framework/data/adonet/configuring-parameters-and-parameter-data-types).
-
- The parameters of the SQL statement or stored procedure.
- To be added.
-
-
-
-
-
- Property
-
- System.Int32
-
-
-
- Gets the number of rows changed, inserted, or deleted by execution of this specific .
-
- The number of rows changed, inserted, or deleted. -1 for SELECT statements; 0 if no rows were affected or the statement failed.
- To be added.
-
-
-
-
diff --git a/doc/snippets/Microsoft.Data.Common/DbBatchCommandCollection.xml b/doc/snippets/Microsoft.Data.Common/DbBatchCommandCollection.xml
deleted file mode 100644
index 610c7860f7..0000000000
--- a/doc/snippets/Microsoft.Data.Common/DbBatchCommandCollection.xml
+++ /dev/null
@@ -1,410 +0,0 @@
-
-
-
-
- System.Object
-
-
-
- System.Collections.Generic.ICollection<Microsoft.Data.Common.DbBatchCommand>
-
-
- System.Collections.Generic.ICollection<T>
-
-
- System.Collections.Generic.IEnumerable<Microsoft.Data.Common.DbBatchCommand>
-
-
- System.Collections.Generic.IEnumerable<T>
-
-
- System.Collections.Generic.IList<Microsoft.Data.Common.DbBatchCommand>
-
-
- System.Collections.IEnumerable
-
-
-
-
- [System.Runtime.CompilerServices.Nullable(0)]
- [<System.Runtime.CompilerServices.Nullable(0)>]
-
-
- [System.Runtime.CompilerServices.NullableContext(1)]
- [<System.Runtime.CompilerServices.NullableContext(1)>]
-
-
-
-
- The base class for a collection of instances of , contained in a .
-
- To be added.
-
-
-
-
- Constructor
-
-
-
- Initializes a new instance of the class.
-
- To be added.
-
-
-
-
-
- Method
-
- M:System.Collections.Generic.ICollection`1.Add(`0)
-
-
- System.Void
-
-
-
-
-
-
- The object to add to the .
-
-
- Adds the specified object to the .
-
- To be added.
-
-
-
-
-
- Method
-
- M:System.Collections.Generic.ICollection`1.Clear
-
-
- System.Void
-
-
-
-
- Removes all values from the .
-
- To be added.
-
-
-
-
-
- Method
-
- M:System.Collections.Generic.ICollection`1.Contains(`0)
-
-
- System.Boolean
-
-
-
-
-
-
- The object to locate in the .
-
-
- Indicates whether a is contained in the collection.
-
-
- if the is in the collection; otherwise .
-
- To be added.
-
-
-
-
-
- Method
-
- M:System.Collections.Generic.ICollection`1.CopyTo(`0[],System.Int32)
-
-
- System.Void
-
-
-
-
-
-
-
- The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing.
-
-
- The zero-based index in at which copying begins.
-
-
- Copies the elements of the to an , starting at a particular index.
-
- To be added.
-
-
-
-
-
- Property
-
- P:System.Collections.Generic.ICollection`1.Count
-
-
- System.Int32
-
-
-
- Gets the number of elements contained in the .
-
-
- The number of elements contained in the .
-
- To be added.
-
-
-
-
-
- Method
-
- Microsoft.Data.Common.DbBatchCommand
-
-
-
-
-
- To be added.
- To be added.
- To be added.
- To be added.
-
-
-
-
-
- Method
-
- M:System.Collections.Generic.IEnumerable`1.GetEnumerator
-
-
- System.Collections.Generic.IEnumerator<Microsoft.Data.Common.DbBatchCommand>
-
-
-
-
- Returns the object at the specified index in the collection.
-
-
- The object at the specified index in the collection.
-
- To be added.
-
-
-
-
-
- Method
-
- M:System.Collections.Generic.IList`1.IndexOf(`0)
-
-
- System.Int32
-
-
-
-
-
-
- The object to locate in the .
-
-
- Returns the index of the specified object.
-
-
- The index of the specified object.
-
- To be added.
-
-
-
-
-
-
-
-
-
- Method
-
- M:System.Collections.Generic.IList`1.Insert(System.Int32,`0)
-
-
- System.Void
-
-
-
-
-
-
-
- The index at which to insert the object.
-
-
- The object to insert into the .
-
-
- Inserts the specified index of the object with the specified name into the collection at the specified index.
-
- To be added.
-
-
-
-
-
- Property
-
- P:System.Collections.Generic.ICollection`1.IsReadOnly
-
-
- System.Boolean
-
-
- Specifies whether the collection is read-only.
-
- if the collection is read-only; otherwise .
-
- To be added.
-
-
-
-
-
- Property
-
- P:System.Collections.Generic.IList`1.Item(System.Int32)
-
-
- Microsoft.Data.Common.DbBatchCommand
-
-
-
-
-
-
- The zero-based index of the .
-
-
- Gets or sets the at the specified index.
-
-
- The at the specified index.
-
- To be added.
- The specified index does not exist.
-
-
-
-
-
- Method
-
- M:System.Collections.Generic.ICollection`1.Remove(`0)
-
-
- System.Boolean
-
-
-
-
-
-
- The object to remove from the .
-
-
- Removes the specified object from the collection.
-
-
- if was successfully removed; otherwise, . This method also returns if was not found in the .
-
- To be added.
-
-
-
-
-
- Method
-
- M:System.Collections.Generic.IList`1.RemoveAt(System.Int32)
-
-
- System.Void
-
-
-
-
-
-
- The index where the object is located.
-
-
- Removes the object at the specified from the collection.
-
- To be added.
-
-
-
-
-
- Method
-
- System.Void
-
-
-
-
-
-
-
- The index where the object is located.
-
- To be added.
-
- Sets the object at the specified index to a new value.
-
- To be added.
-
-
-
-
-
- Method
-
- M:System.Collections.IEnumerable.GetEnumerator
-
-
- System.Collections.IEnumerator
-
-
-
- Returns an enumerator that iterates through a collection.
-
- An object that can be used to iterate through the collection.
-
-
-
- instance is cast to an interface.
-
- ]]>
-
-
-
-
-
-
diff --git a/doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml b/doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml
index 476a7a492e..9ce061e042 100644
--- a/doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml
+++ b/doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml
@@ -52,9 +52,22 @@ The following example creates a an
+
+
+ Gets or sets the
+
+ used by this instance of the
+
+ .
+
+
+
+ Gets or sets the within which the commands execute.
+
- The list of commands contained in the batch in a .
-
+
+ The list of commands contained in the batch in a .
+
an
- The list of commands contained in the batch in a .
+ The list of commands contained in the batch in a
+ of
+ objects.
-
-
-
+
-
-
- Gets or sets the
-
- used by this instance of the
-
- .
-
-
-
-
-
-
-
-
- Gets or sets the within which the commands execute.
-
-
-
-
-
-
Sends the
@@ -125,21 +113,168 @@ The following example creates a an
An asynchronous version of
-
+
, which sends the
-
+
to the
-
+
and builds a
-
- . Exceptions will be reported via the returned Task object.
+ .
+ Exceptions will be reported via the returned Task object.
+
+
+ Gets the collection of objects.
+ The commands contained within the batch.
+
+
+ Gets or sets the used by this .
+ The connection to the data source.
+
+
+ Gets or sets the within which this object executes.
+ The transaction within which a batch of a ADO.NET data provider executes. The default value is a null reference ( in Visual Basic).
+
+
+ Gets or sets the wait time (in seconds) before terminating the attempt to execute the batch and generating an error.
+ The time in seconds to wait for the batch to execute, which is in contract with the underlaying
-
-
-
+ is generated if the assigned property value is less than 0.
+
+ Note to implementers: it's recommended that 0 mean no timeout.
+
+ ]]>
-
+
+
+ Attempts to cancel the execution of a .
+
+
+
+
+
+ Creates a new instance of a object.
+ A object.
+
+
+ Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
+
+
+ An instance of , specifying options for batch execution and data retrieval.
+ Executes the batch against its connection, returning a which can be used to access the results.
+ A object.
+
+ can be used to advance the reader to the next result set.
+
+ > [!NOTE]
+ > This method benefits from , and all the expected exceptions of that method also apply here.
+
+ ]]>
+
+ An error occurred while executing the batch.
+ The value is invalid.
+
+
+ One of the enumeration values that specifies options for batch execution and data retrieval.
+ A token to cancel the asynchronous operation.
+ This implementation invokes the method and returns a completed task. The default implementation will return a cancelled task if passed an already cancelled cancellation token.
+
+This method accepts a cancellation token that can be used to request the operation to be cancelled early.
+ A task representing the asynchronous operation.
+
+ , are still thrown synchronously. For the stored exceptions, see the exceptions thrown by .
+
+ > [!NOTE]
+ > This method benefits from , and all the expected exceptions of that method also apply here.
+
+]]>
+
+ The cancellation token was canceled. This exception is stored into the returned task.
+
+
+ Executes the batch against its connection object, returning the total number of rows affected across all the batch commands.
+ The total number of rows affected across all the batch commands.
+
+ to perform catalog operations (for example, querying the structure of a database or creating database objects such as tables), or to change the data in a database by executing UPDATE, INSERT, or DELETE statements.
+
+ Although does not return any rows, any output parameters or return values mapped to parameters are populated with data.
+
+ For UPDATE, INSERT, and DELETE statements, the return value is the total number of rows affected by the batch. If no UPDATE, INSERT, or DELETE statements are included in the batch, the return value is -1.
+
+> [!NOTE]
+> This method benefits from , and all the expected exceptions of that method also apply here.
+
+ ]]>
+
+
+
+ A token to cancel the asynchronous operation.
+ This is the asynchronous version of .
+
+ The implementation invokes the method and returns a completed task. The default implementation will return a cancelled task if passed an already cancelled cancellation token.
+
+ Do not invoke other methods and properties of the object until the returned Task is complete.
+ A task representing the asynchronous operation.
+
+ , are still thrown synchronously.
+
+> [!NOTE]
+> This method benefits from , and all the expected exceptions of that method also apply here.
+
+]]>
+
+ An error occurred while executing the batch.
+ ADO.NET Overview
+ The cancellation token was canceled. This exception is stored into the returned task.
+
+
+ Executes the batch and returns the first column of the first row in the first returned result set. All other columns, rows and resultsets are ignored.
+ The first column of the first row in the first result set.
+ An error occurred while executing the batch.
+
+
+ A token to cancel the asynchronous operation.
+ An asynchronous version of , which executes the batch and returns the first column of the first row in the first returned result set. All other columns, rows and result sets are ignored.
+ The first column of the first row in the first result set.
+ This method benefits from , and all the expected exceptions of that method also apply here. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as , are still thrown synchronously.
+
+ An error occurred while executing the batch.
+ The cancellation token was canceled. This exception is stored into the returned task.
+
+
+ Creates a prepared (or compiled) version of the batch, or of each of its commands, on the data source.
+
+
+ An optional token to cancel the asynchronous operation. The default value is .
+ Asynchronously creates a prepared (or compiled) version of the batch, or of each of its commands, on the data source.
+ A representing the asynchronous operation.
+ This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as , are still thrown synchronously. For the stored exceptions, see the exceptions thrown by .
+
+ The cancellation token was canceled. This exception is stored into the returned task.
+
diff --git a/doc/snippets/Microsoft.Data.SqlClient/SqlBatchCommand.xml b/doc/snippets/Microsoft.Data.SqlClient/SqlBatchCommand.xml
index 9ad24b8abf..be3744d730 100644
--- a/doc/snippets/Microsoft.Data.SqlClient/SqlBatchCommand.xml
+++ b/doc/snippets/Microsoft.Data.SqlClient/SqlBatchCommand.xml
@@ -1,13 +1,18 @@
+
+
+ SqlBatchCommand allows for the execution of multiple SQL commands in a SqlBatch.
+
+ Initializes a new .
and a , then adds multiple objects to the batch. It then executes the batch, creating a . The example reads through the results of the batch commands, writing them to the console. Finally, the example closes the and then the as the `using` blocks fall out of scope.
+The following example creates a and a SqlBatch, then adds multiple objects to the batch. It then executes the batch, creating a . The example reads through the results of the batch commands, writing them to the console. Finally, the example closes the and then the as the `using` blocks fall out of scope.
[!code-csharp[SqlCommand Example#1](~/../sqlclient/doc/samples/SqlBatch_ExecuteReader.cs#1)]
]]>
@@ -17,52 +22,24 @@ The following example creates a an
Initializes a new .
The text of the .
- Indicates how the property is to be interpreted.
- A , which is used to crate the .
+ Indicates how the property is to be interpreted.
+ A collection of objects is used to create the .
The encryption setting. For more information, see [Always Encrypted](/sql/relational-databases/security/encryption/always-encrypted-database-engine).
-
-
-
-
-
-
- Gets the
-
- .
-
+ Gets the .The parameters of the Transact-SQL statement or stored procedure. The default is an empty collection.
-
-
-
-
-
One of the values, indicating options for statement execution and data retrieval.
-
-
-
-
-
Not currently implemented.
The encryption setting. For more information, see [Always Encrypted](/sql/relational-databases/security/encryption/always-encrypted-database-engine).
-
-
-
-
- Creates a new instance of a object.
@@ -72,5 +49,25 @@ The following example creates a an
Returns whether the method is implemented.
+
+ Gets or sets the text command to run against the data source.
+ The text command to execute. The default value is an empty string ("").
+
+
+ Gets or sets how the property is interpreted.
+ One of the enumeration values that specifies how a command string is interpreted. The default is .
+
+
+ Gets the collection of objects.
+ The parameters of the SQL statement or stored procedure.
+
+
+
+ Gets the number of rows changed, inserted, or deleted by execution of this specific .
+
+
+ The number of rows changed, inserted, or deleted. -1 for SELECT statements; 0 if no rows were affected or the statement failed.
+
+
diff --git a/doc/snippets/Microsoft.Data.SqlClient/SqlBatchCommandCollection.xml b/doc/snippets/Microsoft.Data.SqlClient/SqlBatchCommandCollection.xml
index f350a48731..ca089e9712 100644
--- a/doc/snippets/Microsoft.Data.SqlClient/SqlBatchCommandCollection.xml
+++ b/doc/snippets/Microsoft.Data.SqlClient/SqlBatchCommandCollection.xml
@@ -2,98 +2,175 @@
- A collection of instances of , contained within a .
-
-
-
-
-
-
+
+ A collection of instances of
+ , contained within a
+ .
+
-
- Add a to the end of the .
+
+
+ Add a
+ to the end of the
+ .
+
-
-
-
-
-
-
-
- Determines whether a is in the .
+
+
+
+ The object to add to the .
+
+
+ Adds the specified object to the .
+
+ To be added.
+
+
+
+ Determines whether a
+ is in the
+ .
+
-
-
-
-
-
-
-
- Copies the entire to a one dimensional array, starting at the target index of the target array.
+
+
+
+ The object to locate in the .
+
+
+ Indicates whether a is contained in the collection.
+
+
+ if the is in the collection; otherwise .
+
+ To be added.
+
+
+
+ Copies the entire to a one dimensional array, starting at the target index of the target array.
+
-
-
-
-
-
-
-
- Searches for the specified within the and returns the zero-based index of the first occurence within the entire .
+
+
+
+ The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing.
+
+
+ The zero-based index in at which copying begins.
+
+
+ Copies the elements of the to an , starting at a particular index.
+
+ To be added.
+
+
+
+ Searches for the specified within the and returns the zero-based index of the first occurence within the entire .
+
Returns the zero-based index of the first occurence within the entire .
-
-
-
-
-
-
-
- Inserts an item into the at the specified index.
+
+
+
+ The object to locate in the .
+
+
+ Returns the index of the specified object.
+
+
+ The index of the specified object.
+
+ To be added.
+
+
+
+ Inserts an item into the at the specified index.
+
-
-
-
-
-
-
-
- Removes the first occurence of the specific item from the .
- Returns if an item is successfully removed. Returns false if an item could not be removed or no item was not found.
-
-
-
-
-
-
+
+
+
+ The index at which to insert the object.
+
+
+ The object to insert into the .
+
+
+ Inserts the specified index of the object with the specified name into the collection at the specified index.
+
+ To be added.
+
+
+
+ Removes the first occurence of a specific object from the collection.
+
+
+ Returns if an item is successfully removed. Returns false if an item could not be removed or no item was not found.
+
+
+
+
+ The object to remove from the .
+
+
+ Removes the specified object from the collection.
+
+
+ if was successfully removed; otherwise, . This method also returns if was not found in the .
+
+ To be added.
+ Gets or Sets the element at the specified index.The element at the specified index.
-
-
-
-
- Gets or Sets the element at the specified index.The element at the specified index.
-
-
-
-
-
+
+
+ The index where the object is located.
+
+
+ Returns the object at the specified index in the list.
+
+
+ The object at the specified index in the list.
+
+
+
+
+ The index where the object should be located.
+
+ To be added.
+
+ Sets the object at the specified index to a new value.
+
+ To be added.
+
+
+ Gets the number of elements contained in the .
+ The number of elements contained in the .
+
+
+ Specifies whether the collection is read-only.
+
+ if the collection is read-only; otherwise .
+
+
+ Returns the object at the specified index in the collection.
+ The object at the specified index in the collection.
+
+
+ Removes all values from the .
+
+
+ The index where the object is located.
+ Removes the object at the specified index from the collection.
+
diff --git a/doc/snippets/Microsoft.Data.SqlClient/SqlBulkCopy.xml b/doc/snippets/Microsoft.Data.SqlClient/SqlBulkCopy.xml
index 06fdf1b5b6..6f7cc400d5 100644
--- a/doc/snippets/Microsoft.Data.SqlClient/SqlBulkCopy.xml
+++ b/doc/snippets/Microsoft.Data.SqlClient/SqlBulkCopy.xml
@@ -5,7 +5,7 @@
Lets you efficiently bulk load a SQL Server table with data from another source.
- class lets you write managed code solutions that provide similar functionality. There are other ways to load data into a SQL Server table (INSERT statements, for example), but offers a significant performance advantage over them. The class can be used to write data only to SQL Server tables. However, the data source is not limited to SQL Server; any data source can be used, as long as the data can be loaded to a instance or read with a instance. will fail when bulk loading a column of type into a SQL Server column whose type is one of the date/time types added in SQL Server 2008.
diff --git a/doc/snippets/Microsoft.Data.SqlClient/SqlCommand.xml b/doc/snippets/Microsoft.Data.SqlClient/SqlCommand.xml
index 8dea0674cc..a19cff3c8a 100644
--- a/doc/snippets/Microsoft.Data.SqlClient/SqlCommand.xml
+++ b/doc/snippets/Microsoft.Data.SqlClient/SqlCommand.xml
@@ -1339,10 +1339,10 @@ The method is a st
- To be added.
+ Gets the collection of objects.
- To be added.
+ The parameters of the SQL statement or stored procedure.
To be added.
diff --git a/doc/snippets/Microsoft.Data.SqlClient/SqlConnection.xml b/doc/snippets/Microsoft.Data.SqlClient/SqlConnection.xml
index dde09d58b7..7833db6f4a 100644
--- a/doc/snippets/Microsoft.Data.SqlClient/SqlConnection.xml
+++ b/doc/snippets/Microsoft.Data.SqlClient/SqlConnection.xml
@@ -145,10 +145,11 @@ using (SqlConnection connection = new SqlConnection(connectionString))
The Func that takes a and and returns a .
-
+ .
+ The following example demonstrates how to define and set an .
[!code-csharp[SqlConnection_AccessTokenCallback Example#1](~/../sqlclient/doc/samples/SqlConnection_AccessTokenCallback.cs#1)]
@@ -299,6 +300,21 @@ using (SqlConnection connection = new SqlConnection(connectionString))
Parallel transactions are not allowed when using Multiple Active Result Sets (MARS).Parallel transactions are not supported.
+
+ Gets a value that indicates whether this instance supports the class.
+
+ if this instance supports the class; otherwise, . The default is .
+
+
+ and overrides `CanCreateBatch` property to return `true`.
+
+ ]]>
+
+
The name of the database to use instead of the current database.
Changes the current database for an open .
@@ -659,6 +675,10 @@ End Module
]]>
+
+ Returns a new instance of the class that implements the class.
+ A new instance of .
+ To be added.To be added.
diff --git a/doc/snippets/Microsoft.Data.SqlClient/SqlException.xml b/doc/snippets/Microsoft.Data.SqlClient/SqlException.xml
index 044606269f..c6441167cf 100644
--- a/doc/snippets/Microsoft.Data.SqlClient/SqlException.xml
+++ b/doc/snippets/Microsoft.Data.SqlClient/SqlException.xml
@@ -140,7 +140,7 @@ catch (Exception ex) {
-
+ Gets the line number within the Transact-SQL command batch or stored procedure that generated the error.
@@ -292,6 +292,19 @@ catch (Exception ex) {
+
+ If this was thrown when executing a , references the specific which triggered the exception.
+ The specific which triggered the exception.
+
+ wasn't thrown when executing a , the value is `null`.
+
+ ]]>
+
+ Gets a numeric error code from SQL Server that represents an error, warning or "no data found" message. For more information about how to decode these values, see Database Engine Events and Errors.The number representing the error code.
diff --git a/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.cs b/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.cs
index b114fc57b1..ba7a1cd534 100644
--- a/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.cs
+++ b/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.cs
@@ -388,7 +388,6 @@ public void Remove(SqlBulkCopyColumnOrderHint columnOrderHint) { }
///
public new void RemoveAt(int index) { }
}
-
///
[System.FlagsAttribute]
public enum SqlBulkCopyOptions
diff --git a/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj b/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj
index 9d29c3009a..9ab6b8d80f 100644
--- a/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj
+++ b/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.csproj
@@ -16,7 +16,7 @@
-
+
diff --git a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs
index d9812157a5..4b4e7ccc43 100644
--- a/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs
+++ b/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs
@@ -1793,10 +1793,10 @@ public override DataTable GetSchema(string collectionName, string[] restrictionV
}
#if NET6_0_OR_GREATER
- ///
+ ///
public override bool CanCreateBatch => true;
- ///
+ ///
protected override DbBatch CreateDbBatch() => new SqlBatch(this);
#endif
diff --git a/src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.Batch.NetCoreApp.cs b/src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.Batch.NetCoreApp.cs
index 6ff4060093..c49273bbf8 100644
--- a/src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.Batch.NetCoreApp.cs
+++ b/src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.Batch.NetCoreApp.cs
@@ -1,9 +1,29 @@
-namespace System.Data.Common
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Microsoft.Data.SqlClient
{
///
public partial class SqlBatchCommand
{
- ///
+ ///
public Microsoft.Data.SqlClient.SqlCommandColumnEncryptionSetting ColumnEncryptionSetting { get { throw null; } set { } }
}
+
+ ///
+ public partial class SqlConnection
+ {
+ ///
+ public override bool CanCreateBatch { get { throw null; } }
+ ///
+ protected override System.Data.Common.DbBatch CreateDbBatch() => throw null;
+ }
+
+ ///
+ public partial class SqlException
+ {
+ ///
+ protected override System.Data.Common.DbBatchCommand DbBatchCommand => throw null;
+ }
}
diff --git a/src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.Batch.cs b/src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.Batch.cs
index be9b716150..1b66106439 100644
--- a/src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.Batch.cs
+++ b/src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.Batch.cs
@@ -11,111 +11,115 @@ public class SqlBatch : System.Data.Common.DbBatch
public SqlBatch() { throw null; }
///
public SqlBatch(Microsoft.Data.SqlClient.SqlConnection connection, Microsoft.Data.SqlClient.SqlTransaction transaction = null) { throw null; }
- ///
- public override int Timeout { get => throw null; set { } }
///
- public new Microsoft.Data.SqlClient.SqlConnection Connection { get => throw null; set { } }
+ public override int Timeout { get => throw null; set { } }
+ ///
+ public System.Collections.Generic.List Commands { get { throw null; } }
///
- public new Microsoft.Data.SqlClient.SqlTransaction Transaction { get => throw null; set { } }
+ public new Microsoft.Data.SqlClient.SqlConnection Connection { get => throw null; set { } }
///
+ public new Microsoft.Data.SqlClient.SqlTransaction Transaction { get => throw null; set { } }
+ ///
public new SqlBatchCommandCollection BatchCommands { get => throw null; }
- ///
+ ///
protected override System.Data.Common.DbBatchCommandCollection DbBatchCommands { get => throw null; }
- ///
+ ///
protected override System.Data.Common.DbConnection DbConnection { get => throw null; set { } }
- ///
- protected override System.Data.Common.DbTransaction DbTransaction { get => throw null; set { } }
- ///
+ ///
+ protected override System.Data.Common.DbTransaction DbTransaction { get => throw null; set { } }
+ ///
public override void Cancel() => throw null;
- ///
+ ///
+ protected override System.Data.Common.DbBatchCommand CreateDbBatchCommand() => throw null;
+ ///
+ public override void Dispose() => throw null;
+ ///
+ protected override System.Data.Common.DbDataReader ExecuteDbDataReader(System.Data.CommandBehavior behavior) => throw null;
+ ///
+ protected override System.Threading.Tasks.Task ExecuteDbDataReaderAsync(System.Data.CommandBehavior behavior, System.Threading.CancellationToken cancellationToken) => throw null;
+ ///
public override int ExecuteNonQuery() => throw null;
- ///
+ ///
public override System.Threading.Tasks.Task ExecuteNonQueryAsync(System.Threading.CancellationToken cancellationToken = default) => throw null;
- ///
+ ///
+ public Microsoft.Data.SqlClient.SqlDataReader ExecuteReader() => throw null;
+ ///
+ public Microsoft.Data.SqlClient.SqlDataReader ExecuteReaderAsync() => throw null;
+ ///
public override object ExecuteScalar() => throw null;
- ///
+ ///
public override System.Threading.Tasks.Task