Skip to content

Commit

Permalink
make EnableOptimizedParameterBinding only apply to text mode commands…
Browse files Browse the repository at this point in the history
… and update documentation to match.
  • Loading branch information
Wraith2 committed Mar 19, 2024
1 parent 9056f13 commit 5821e92
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion doc/snippets/Microsoft.Data.SqlClient/SqlCommand.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,8 @@ The <xref:Microsoft.Data.SqlClient.SqlCommand.CreateParameter%2A> method is a st
</Dispose>
<EnableOptimizedParameterBinding>
<summary>
Gets or sets a value indicating whether the command object should optimize parameter performance by disabling Output and InputOutput directions when submitting the command to the SQL Server.
Gets or sets a value indicating whether the command object should optimize parameter performance by disabling Output and InputOutput directions when submitting the command to the SQL Server. <br />
This option is only used when the <see cref="P:Microsoft.Data.SqlClient.SqlCommand.CommandType" /> is <see cref="System.Data.CommandType.Text" >Text</see> otherwise it is ignored.
</summary>
<value>
A value indicating whether the command object should optimize parameter performance by disabling Output and InputOuput parameter directions when submitting the command to the SQL Server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10103,7 +10103,7 @@ internal Task TdsExecuteRPC(SqlCommand cmd, IList<_SqlRPC> rpcArray, int timeout
int parametersLength = rpcext.userParamCount + rpcext.systemParamCount;

bool isAdvancedTraceOn = SqlClientEventSource.Log.IsAdvancedTraceOn();
bool enableOptimizedParameterBinding = cmd.EnableOptimizedParameterBinding;
bool enableOptimizedParameterBinding = cmd.EnableOptimizedParameterBinding && cmd.CommandType == CommandType.Text;

for (int i = (ii == startRpc) ? startParam : 0; i < parametersLength; i++)
{
Expand Down

0 comments on commit 5821e92

Please sign in to comment.