Skip to content

Commit

Permalink
Duplicate Features from DbBatch
Browse files Browse the repository at this point in the history
  • Loading branch information
H-Yeo committed Feb 13, 2024
1 parent 0e8e54a commit c7fd5f1
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 16 deletions.
50 changes: 50 additions & 0 deletions doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,55 @@ The following example creates a <xref:Microsoft.Data.SqlClient.SqlConnection> an
</format>
</remarks>
</ExecuteReaderAsync>
<Timeout>
<summary>Gets or sets the wait time (in seconds) before terminating the attempt to execute the batch and generating an error.</summary>
<value>The time in seconds to wait for the batch to execute.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
An <xref:System.ArgumentException> is generated if the assigned <xref:System.Data.Common.DbBatch.Timeout%2A> property value is less than 0.
Note to implementers: it's recommended that 0 mean no timeout.
]]></format>
</remarks>
</Timeout>
<ExecuteNonQueryAsync>
<param name="cancellationToken">A token to cancel the asynchronous operation.</param>
<summary>This is the asynchronous version of <see cref="M:System.Data.Common.DbBatch.ExecuteNonQuery" />. Providers should override with an appropriate implementation. The cancellation token may optionally be ignored.

The default implementation invokes the synchronous <see cref="M:System.Data.Common.DbBatch.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.DbBatch.ExecuteNonQuery" /> will be communicated via the returned Task Exception property.

Do not invoke other methods and properties of the <see langword="DbCommand" /> object until the returned Task is complete.</summary>
<returns>A task representing the asynchronous operation.</returns>
</ExecuteNonQueryAsync>
<ExecuteScalarAsync>
<param name="cancellationToken">To be added.</param>
<summary>An asynchronous version of <see cref="System.Data.Common.DbBatch.ExecuteReader" />, which executes the batch against its connection, returning a <see cref="T:System.Data.Common.DbDataReader" /> which can be used to access the results.</summary>
<returns>A task representing the asynchronous operation.</returns>
</ExecuteScalarAsync>
<PrepareAsync>
<param name="cancellationToken">An optional token to cancel the asynchronous operation. The default value is <see cref="P:System.Threading.CancellationToken.None" />.</param>
<summary>Asynchronously creates a prepared (or compiled) version of the batch, or of each of its commands, on the data source.</summary>
<returns>A <see cref="T:System.Threading.Tasks.Task" /> representing the asynchronous operation.</returns>
<remarks>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 <see cref="T:System.ArgumentException" />, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by <see cref="M:System.Data.Common.DbBatch.Prepare" />.</remarks>
</PrepareAsync>
<ExecuteDbDataReader>
<param name="behavior">An instance of <see cref="T:System.Data.CommandBehavior" />, specifying options for batch execution and data retrieval.</param>
<summary>When overridden in a derived class, executes the batch against its connection, returning a <see cref="T:System.Data.Common.DbDataReader" /> which can be used to access the results.</summary>
<returns>A <see cref="T:System.Data.Common.DbDataReader" /> object.</returns>
</ExecuteDbDataReader>
<ExecuteDbDataReaderAsync>
<param name="behavior">One of the enumeration values that specifies options for batch execution and data retrieval.</param>
<param name="cancellationToken">A token to cancel the asynchronous operation.</param>
<summary>Providers should implement this method to provide a non-default implementation for <see cref="System.Data.IDbCommand.ExecuteReader()"/> overloads.

The default implementation invokes the synchronous <see cref="M:System.Data.IDbCommand.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.

This method accepts a cancellation token that can be used to request the operation to be cancelled early. Implementations may ignore this request.</summary>
<returns>A task representing the asynchronous operation.</returns>
</ExecuteDbDataReaderAsync>
</members>
</docs>
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public class SqlBatch : System.Data.Common.DbBatch
public SqlBatch() { throw null; }
/// <include file='../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/ctor2/*'/>
public SqlBatch(Microsoft.Data.SqlClient.SqlConnection connection, Microsoft.Data.SqlClient.SqlTransaction transaction = null) { throw null; }
/// <inheritdoc cref="System.Data.Common.DbBatch.Timeout"/>
public override int Timeout { get => throw null; set { } }
/// <include file='../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/Timeout/*'/>
public override int Timeout { get => throw null; set { } }
/// <include file='../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/Connection/*'/>
public new Microsoft.Data.SqlClient.SqlConnection Connection { get => throw null; set { } }
/// <include file='../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/Transaction/*'/>
Expand All @@ -29,19 +29,19 @@ public class SqlBatch : System.Data.Common.DbBatch
public override void Cancel() => throw null;
/// <inheritdoc cref="System.Data.Common.DbBatch.ExecuteNonQuery"/>
public override int ExecuteNonQuery() => throw null;
/// <inheritdoc cref="System.Data.Common.DbBatch.ExecuteNonQueryAsync(System.Threading.CancellationToken)"/>
/// <include file='../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/ExecuteNonQueryAsync/*'/>
public override System.Threading.Tasks.Task<int> ExecuteNonQueryAsync(System.Threading.CancellationToken cancellationToken = default) => throw null;
/// <inheritdoc cref="System.Data.Common.DbBatch.ExecuteScalar"/>
public override object ExecuteScalar() => throw null;
/// <inheritdoc cref="System.Data.Common.DbBatch.ExecuteScalarAsync(System.Threading.CancellationToken)"/>
/// <include file='../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/ExecuteScalarAsync/*'/>
public override System.Threading.Tasks.Task<object> ExecuteScalarAsync(System.Threading.CancellationToken cancellationToken = default) => throw null;
/// <inheritdoc cref="System.Data.Common.DbBatch.Prepare"/>
public override void Prepare() => throw null;
/// <inheritdoc cref="System.Data.Common.DbBatch.PrepareAsync(System.Threading.CancellationToken)"/>
/// <include file='../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/PrepareAsync/*'/>
public override System.Threading.Tasks.Task PrepareAsync(System.Threading.CancellationToken cancellationToken = default) => throw null;
/// <inheritdoc cref="System.Data.Common.DbBatch.ExecuteDbDataReader(System.Data.CommandBehavior)"/>
/// <include file='../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/ExecuteDbDataReader/*'/>
protected override System.Data.Common.DbDataReader ExecuteDbDataReader(System.Data.CommandBehavior behavior) => throw null;
/// <inheritdoc cref="System.Data.Common.DbBatch.ExecuteDbDataReaderAsync(System.Data.CommandBehavior, System.Threading.CancellationToken)"/>
/// <include file='../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/ExecuteDbDataReaderAsync/*'/>
protected override System.Threading.Tasks.Task<System.Data.Common.DbDataReader> ExecuteDbDataReaderAsync(System.Data.CommandBehavior behavior, System.Threading.CancellationToken cancellationToken) => throw null;
/// <include file='../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/Commands/*'/>
public System.Collections.Generic.List<Microsoft.Data.SqlClient.SqlBatchCommand> Commands { get { throw null; } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public SqlBatch(SqlConnection connection = null, SqlTransaction transaction = nu
Connection = connection;
Transaction = transaction;
}
/// <inheritdoc cref="System.Data.Common.DbBatch.Timeout"/>
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/Timeout/*'/>
public override int Timeout
{
get
Expand Down Expand Up @@ -91,7 +91,7 @@ public override int ExecuteNonQuery()
SetupBatchCommandExecute();
return _batchCommand.ExecuteNonQuery();
}
/// <inheritdoc cref="System.Data.Common.DbBatch.ExecuteNonQueryAsync(System.Threading.CancellationToken)"/>
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/ExecuteNonQueryAsync/*'/>
public override Task<int> ExecuteNonQueryAsync(CancellationToken cancellationToken = default)
{
CheckDisposed();
Expand All @@ -105,7 +105,7 @@ public override object ExecuteScalar()
SetupBatchCommandExecute();
return _batchCommand.ExecuteScalar();
}
/// <inheritdoc cref="System.Data.Common.DbBatch.ExecuteScalarAsync(System.Threading.CancellationToken)"/>
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/ExecuteScalarAsync/*'/>
public override Task<object> ExecuteScalarAsync(CancellationToken cancellationToken = default)
{
CheckDisposed();
Expand All @@ -117,7 +117,7 @@ public override void Prepare()
{
CheckDisposed();
}
/// <inheritdoc cref="System.Data.Common.DbBatch.PrepareAsync(System.Threading.CancellationToken)"/>
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/PrepareAsync/*'/>
public override Task PrepareAsync(CancellationToken cancellationToken = default)
{
CheckDisposed();
Expand Down Expand Up @@ -182,10 +182,10 @@ public SqlDataReader ExecuteReader()
CheckDisposed();
SetupBatchCommandExecute();
return _batchCommand.ExecuteReaderAsync(cancellationToken);
}
/// <inheritdoc cref="System.Data.Common.DbBatch.ExecuteDbDataReader(System.Data.CommandBehavior)"/>
}
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/ExecuteReader/*'/>
protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior) => ExecuteReader();
/// <inheritdoc cref="System.Data.Common.DbBatch.ExecuteDbDataReaderAsync(System.Data.CommandBehavior, System.Threading.CancellationToken)"/>
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/ExecuteDbDataReaderAsync/*'/>
protected override Task<DbDataReader> ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
{
CheckDisposed();
Expand All @@ -203,8 +203,8 @@ protected override Task<DbDataReader> ExecuteDbDataReaderAsync(CommandBehavior b
TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.NotOnCanceled,
TaskScheduler.Default
);
}
/// <inheritdoc cref="System.Data.Common.DbBatch.CreateDbBatchCommand"/>
}
/// <inheritdoc cref="System.Data.Common.DbBatch.CreateDbBatchCommand"/>
protected override DbBatchCommand CreateDbBatchCommand()
{
return new SqlBatchCommand();
Expand Down

0 comments on commit c7fd5f1

Please sign in to comment.