Skip to content

Commit 5821e92

Browse files
committed
make EnableOptimizedParameterBinding only apply to text mode commands and update documentation to match.
1 parent 9056f13 commit 5821e92

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

doc/snippets/Microsoft.Data.SqlClient/SqlCommand.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1385,7 +1385,8 @@ The <xref:Microsoft.Data.SqlClient.SqlCommand.CreateParameter%2A> method is a st
13851385
</Dispose>
13861386
<EnableOptimizedParameterBinding>
13871387
<summary>
1388-
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.
1388+
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 />
1389+
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.
13891390
</summary>
13901391
<value>
13911392
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.

src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/TdsParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10103,7 +10103,7 @@ internal Task TdsExecuteRPC(SqlCommand cmd, IList<_SqlRPC> rpcArray, int timeout
1010310103
int parametersLength = rpcext.userParamCount + rpcext.systemParamCount;
1010410104

1010510105
bool isAdvancedTraceOn = SqlClientEventSource.Log.IsAdvancedTraceOn();
10106-
bool enableOptimizedParameterBinding = cmd.EnableOptimizedParameterBinding;
10106+
bool enableOptimizedParameterBinding = cmd.EnableOptimizedParameterBinding && cmd.CommandType == CommandType.Text;
1010710107

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

0 commit comments

Comments
 (0)