diff --git a/doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml b/doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml index e847c96df6..c135f2bbcb 100644 --- a/doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml +++ b/doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml @@ -52,19 +52,9 @@ The following example creates a an - - - - - - The list of commands contained in the batch in a - of - objects. - - - - - + + + Gets or sets the @@ -88,7 +78,7 @@ The following example creates a an ]]> - + The list of commands contained in the batch in a . @@ -104,7 +94,52 @@ The following example creates a an - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The list of commands contained in the batch in a + of + objects. + + + + + Sends the @@ -126,7 +161,6 @@ The following example creates a an - An asynchronous version of @@ -145,6 +179,9 @@ The following example creates a an ]]> - + + + + 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 72ce936cdc..4d634ef97d 100644 --- a/src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.Batch.cs +++ b/src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.Batch.cs @@ -11,7 +11,7 @@ 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 { } } @@ -19,35 +19,35 @@ public class SqlBatch : System.Data.Common.DbBatch 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 { } } - /// + /// public override void Cancel() => throw null; - /// + /// public override int ExecuteNonQuery() => throw null; - /// + /// public override System.Threading.Tasks.Task ExecuteNonQueryAsync(System.Threading.CancellationToken cancellationToken = default) => throw null; - /// + /// public override object ExecuteScalar() => throw null; - /// + /// public override System.Threading.Tasks.Task ExecuteScalarAsync(System.Threading.CancellationToken cancellationToken = default) => throw null; - /// + /// public override void Prepare() => throw null; - /// + /// public override System.Threading.Tasks.Task PrepareAsync(System.Threading.CancellationToken cancellationToken = default) => 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 System.Collections.Generic.List Commands { get { throw null; } } /// public Microsoft.Data.SqlClient.SqlDataReader ExecuteReader() => throw null; - /// + /// protected override System.Data.Common.DbBatchCommand CreateDbBatchCommand() => throw null; } /// diff --git a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlBatch.cs b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlBatch.cs index 3250e9cd6e..52e8b73729 100644 --- a/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlBatch.cs +++ b/src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlBatch.cs @@ -4,6 +4,7 @@ #if NET6_0_OR_GREATER + using System.Collections.Generic; using System.Data; using System.Data.Common; @@ -32,7 +33,7 @@ public SqlBatch(SqlConnection connection = null, SqlTransaction transaction = nu Connection = connection; Transaction = transaction; } - /// + /// public override int Timeout { get @@ -46,11 +47,11 @@ public override int Timeout _batchCommand.CommandTimeout = value; } } - /// + /// protected override DbBatchCommandCollection DbBatchCommands => BatchCommands; /// public new SqlBatchCommandCollection BatchCommands => _providerCommands != null ? _providerCommands : _providerCommands = new SqlBatchCommandCollection(Commands); // Commands call will check disposed - /// + /// protected override DbConnection DbConnection { get @@ -64,7 +65,7 @@ protected override DbConnection DbConnection Connection = (SqlConnection)value; } } - /// + /// protected override DbTransaction DbTransaction { get @@ -78,47 +79,46 @@ protected override DbTransaction DbTransaction Transaction = (SqlTransaction)value; } } - - /// + /// public override void Cancel() { CheckDisposed(); _batchCommand.Cancel(); } - /// + /// public override int ExecuteNonQuery() { CheckDisposed(); SetupBatchCommandExecute(); return _batchCommand.ExecuteNonQuery(); } - /// + /// public override Task ExecuteNonQueryAsync(CancellationToken cancellationToken = default) { CheckDisposed(); SetupBatchCommandExecute(); return _batchCommand.ExecuteNonQueryAsync(cancellationToken); } - /// + /// public override object ExecuteScalar() { CheckDisposed(); SetupBatchCommandExecute(); return _batchCommand.ExecuteScalar(); } - /// + /// public override Task ExecuteScalarAsync(CancellationToken cancellationToken = default) { CheckDisposed(); SetupBatchCommandExecute(); return _batchCommand.ExecuteScalarBatchAsync(cancellationToken); } - /// + /// public override void Prepare() { CheckDisposed(); } - /// + /// public override Task PrepareAsync(CancellationToken cancellationToken = default) { CheckDisposed(); @@ -184,9 +184,9 @@ public SqlDataReader ExecuteReader() SetupBatchCommandExecute(); return _batchCommand.ExecuteReaderAsync(cancellationToken); } - /// + /// protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior) => ExecuteReader(); - /// + /// protected override Task ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken) { CheckDisposed(); @@ -205,6 +205,11 @@ protected override Task ExecuteDbDataReaderAsync(CommandBehavior b TaskScheduler.Default ); } + /// + protected override DbBatchCommand CreateDbBatchCommand() + { + return new SqlBatchCommand(); + } private void CheckDisposed() { @@ -231,11 +236,6 @@ private void SetupBatchCommandExecute() } _batchCommand.SetBatchRPCModeReadyToExecute(); } - /// - protected override DbBatchCommand CreateDbBatchCommand() - { - return new SqlBatchCommand(); - } } }