Skip to content

Commit

Permalink
Fix SqlBatch API Documentation - For Consistency Verification Against…
Browse files Browse the repository at this point in the history
… MS Doc Generation
  • Loading branch information
H-Yeo committed Feb 2, 2024
1 parent 17c86d4 commit 66ad6a5
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 50 deletions.
71 changes: 54 additions & 17 deletions doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml
Expand Up @@ -52,19 +52,9 @@ The following example creates a <xref:Microsoft.Data.SqlClient.SqlConnection> an
</format>
</remarks>
</ctor2>
<timeout>
<inheritdoc cref="P:System.Common.DbBatch.Timeout" />
</timeout>
<Commands>
<summary>
The list of commands contained in the batch in a
<see cref="T:System.Collection.Generic.List"/> of
<see cref="T:Microsoft.Data.SqlClient.SqlBatchCommand"/> objects.
</summary>
<remarks>
<format type="text/markdown"></format>
</remarks>
</Commands>
<Timeout>
<inheritdoc cref="P:Microsoft.Data.SqlClient.SqlBatch.Timeout"/>
</Timeout>
<Connection>
<summary>
Gets or sets the
Expand All @@ -88,7 +78,7 @@ The following example creates a <xref:Microsoft.Data.SqlClient.SqlConnection> an
]]>
</format>
</remarks>
</Transaction>
</Transaction>
<BatchCommands>
<summary>
The list of commands contained in the batch in a <see cref="T:Microsoft.Data.SqlClient.SqlBatchCommandCollection" />.
Expand All @@ -104,7 +94,52 @@ The following example creates a <xref:Microsoft.Data.SqlClient.SqlConnection> an
</format>
</remarks>
</BatchCommands>

<DbBatchCommands>
<inheritdoc cref="P:Microsoft.Data.SqlClient.SqlBatch.DbBatchCommands"/>
</DbBatchCommands>
<DbConnection>
<inheritdoc cref="P:Microsoft.Data.SqlClient.SqlBatch.DbConnection"/>
</DbConnection>
<DbTransaction>
<inheritdoc cref="P:Microsoft.Data.SqlClient.SqlBatch.DbTransaction"/>
</DbTransaction>
<Cancel>
<inheritdoc cref="P:Microsoft.Data.SqlClient.SqlBatch.Cancel"/>
</Cancel>
<ExecuteNonQuery>
<inheritdoc cref="P:Microsoft.Data.SqlClient.SqlBatch.ExecuteNonQuery"/>
</ExecuteNonQuery>
<ExecuteNonQueryAsync>
<inheritdoc cref="P:Microsoft.Data.SqlClient.SqlBatch.ExecuteNonQueryAsync"/>
</ExecuteNonQueryAsync>
<ExecuteScalar>
<inheritdoc cref="P:Microsoft.Data.SqlClient.SqlBatch.ExecuteScalar"/>
</ExecuteScalar>
<ExecuteScalarAsync>
<inheritdoc cref="P:Microsoft.Data.SqlClient.SqlBatch.ExecuteScalarAsync"/>
</ExecuteScalarAsync>
<Prepare>
<inheritdoc cref="P:Microsoft.Data.SqlClient.SqlBatch.Prepare"/>
</Prepare>
<PrepareAsync>
<inheritdoc cref="P:Microsoft.Data.SqlClient.SqlBatch.PrepareAsync"/>
</PrepareAsync>
<ExecuteDbDataReader>
<inheritdoc cref="P:Microsoft.Data.SqlClient.SqlBatch.ExecuteDbDataReader"/>
</ExecuteDbDataReader>
<ExecuteDbDataReaderAsync>
<inheritdoc cref="P:Microsoft.Data.SqlClient.SqlBatch.ExecuteDbDataReaderAsync"/>
</ExecuteDbDataReaderAsync>
<Commands>
<summary>
The list of commands contained in the batch in a
<see cref="T:System.Collections.Generic.List"/> of
<see cref="T:Microsoft.Data.SqlClient.SqlBatchCommand"/> objects.
</summary>
<remarks>
<format type="text/markdown"></format>
</remarks>
</Commands>
<ExecuteReader>
<summary>
Sends the
Expand All @@ -126,7 +161,6 @@ The following example creates a <xref:Microsoft.Data.SqlClient.SqlConnection> an
</format>
</remarks>
</ExecuteReader>

<ExecuteReaderAsync>
<summary>
An asynchronous version of
Expand All @@ -145,6 +179,9 @@ The following example creates a <xref:Microsoft.Data.SqlClient.SqlConnection> an
]]>
</format>
</remarks>
</ExecuteReaderAsync>
</ExecuteReaderAsync>
<CreateDbBatchCommand>
<inheritdoc cref="P:Microsoft.Data.SqlClient.SqlBatch.CreateDbBatchCommand"/>
</CreateDbBatchCommand>
</members>
</docs>
28 changes: 14 additions & 14 deletions src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.Batch.cs
Expand Up @@ -11,43 +11,43 @@ 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; }
/// <include file='../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/timeout/*'/>
/// <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/*'/>
public new Microsoft.Data.SqlClient.SqlTransaction Transaction { get => throw null; set { } }
/// <include file='../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/BatchCommands/*'/>
public new SqlBatchCommandCollection BatchCommands { get => throw null; }
/// <inheritdoc />
/// <include file='../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/DbBatchCommands/*'/>
protected override System.Data.Common.DbBatchCommandCollection DbBatchCommands { get => throw null; }
/// <inheritdoc />
/// <include file='../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/DbConnection/*'/>
protected override System.Data.Common.DbConnection DbConnection { get => throw null; set { } }
/// <inheritdoc />
/// <include file='../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/DbTransaction/*'/>
protected override System.Data.Common.DbTransaction DbTransaction { get => throw null; set { } }
/// <inheritdoc />
/// <include file='../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/Cancel/*'/>
public override void Cancel() => throw null;
/// <inheritdoc />
/// <include file='../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/ExecuteNonQuery/*'/>
public override int ExecuteNonQuery() => throw null;
/// <inheritdoc />
/// <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 />
/// <include file='../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/ExecuteScalar/*'/>
public override object ExecuteScalar() => throw null;
/// <inheritdoc />
/// <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 />
/// <include file='../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/Prepare/*'/>
public override void Prepare() => throw null;
/// <inheritdoc />
/// <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 />
/// <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 />
/// <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; } }
/// <include file='../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/ExecuteReader/*'/>
public Microsoft.Data.SqlClient.SqlDataReader ExecuteReader() => throw null;
/// <inheritdoc />
/// <include file='../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/CreateDbBatchCommand/*'/>
protected override System.Data.Common.DbBatchCommand CreateDbBatchCommand() => throw null;
}
/// <include file='../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatchCommand.xml' path='docs/members[@name="SqlBatchCommand"]/SqlBatchCommand/*'/>
Expand Down
Expand Up @@ -4,6 +4,7 @@

#if NET6_0_OR_GREATER


using System.Collections.Generic;
using System.Data;
using System.Data.Common;
Expand Down Expand Up @@ -32,7 +33,7 @@ public SqlBatch(SqlConnection connection = null, SqlTransaction transaction = nu
Connection = connection;
Transaction = transaction;
}
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/timeout/*'/>
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/Timeout/*'/>
public override int Timeout
{
get
Expand All @@ -46,11 +47,11 @@ public override int Timeout
_batchCommand.CommandTimeout = value;
}
}
/// <inheritdoc />
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/DbBatchCommands/*'/>
protected override DbBatchCommandCollection DbBatchCommands => BatchCommands;
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/BatchCommands/*'/>
public new SqlBatchCommandCollection BatchCommands => _providerCommands != null ? _providerCommands : _providerCommands = new SqlBatchCommandCollection(Commands); // Commands call will check disposed
/// <inheritdoc />
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/DbConnection/*'/>
protected override DbConnection DbConnection
{
get
Expand All @@ -64,7 +65,7 @@ protected override DbConnection DbConnection
Connection = (SqlConnection)value;
}
}
/// <inheritdoc />
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/DbTransaction/*'/>
protected override DbTransaction DbTransaction
{
get
Expand All @@ -78,47 +79,46 @@ protected override DbTransaction DbTransaction
Transaction = (SqlTransaction)value;
}
}

/// <inheritdoc />
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/Cancel/*'/>
public override void Cancel()
{
CheckDisposed();
_batchCommand.Cancel();
}
/// <inheritdoc />
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/ExecuteNonQuery/*'/>
public override int ExecuteNonQuery()
{
CheckDisposed();
SetupBatchCommandExecute();
return _batchCommand.ExecuteNonQuery();
}
/// <inheritdoc />
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/ExecuteNonQueryAsync/*'/>
public override Task<int> ExecuteNonQueryAsync(CancellationToken cancellationToken = default)
{
CheckDisposed();
SetupBatchCommandExecute();
return _batchCommand.ExecuteNonQueryAsync(cancellationToken);
}
/// <inheritdoc />
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/ExecuteScalar/*'/>
public override object ExecuteScalar()
{
CheckDisposed();
SetupBatchCommandExecute();
return _batchCommand.ExecuteScalar();
}
/// <inheritdoc />
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/ExecuteScalarAsync/*'/>
public override Task<object> ExecuteScalarAsync(CancellationToken cancellationToken = default)
{
CheckDisposed();
SetupBatchCommandExecute();
return _batchCommand.ExecuteScalarBatchAsync(cancellationToken);
}
/// <inheritdoc />
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/Prepare/*'/>
public override void Prepare()
{
CheckDisposed();
}
/// <inheritdoc />
/// <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 @@ -184,9 +184,9 @@ public new Task<SqlDataReader> ExecuteReaderAsync(CancellationToken cancellation
SetupBatchCommandExecute();
return _batchCommand.ExecuteReaderAsync(cancellationToken);
}
/// <inheritdoc />
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/ExecuteDbDataReader/*'/>
protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior) => ExecuteReader();
/// <inheritdoc />
/// <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 @@ -205,6 +205,11 @@ protected override Task<DbDataReader> ExecuteDbDataReaderAsync(CommandBehavior b
TaskScheduler.Default
);
}
/// <include file='../../../../../../doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml' path='docs/members[@name="SqlBatch"]/CreateDbBatchCommand/*'/>
protected override DbBatchCommand CreateDbBatchCommand()
{
return new SqlBatchCommand();
}

private void CheckDisposed()
{
Expand All @@ -231,11 +236,6 @@ private void SetupBatchCommandExecute()
}
_batchCommand.SetBatchRPCModeReadyToExecute();
}
/// <inheritdoc />
protected override DbBatchCommand CreateDbBatchCommand()
{
return new SqlBatchCommand();
}
}
}

Expand Down

0 comments on commit 66ad6a5

Please sign in to comment.