Skip to content

Commit 05d51bf

Browse files
author
SqlClient Azure DevOps
committed
Merge in 'main' changes
2 parents 7def235 + 910bdb4 commit 05d51bf

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
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/netcore/src/Microsoft/Data/SqlClient/TdsParser.cs

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

89908990
bool isAdvancedTraceOn = SqlClientEventSource.Log.IsAdvancedTraceOn();
8991-
bool enableOptimizedParameterBinding = cmd.EnableOptimizedParameterBinding;
8991+
bool enableOptimizedParameterBinding = cmd.EnableOptimizedParameterBinding && cmd.CommandType == CommandType.Text;
89928992

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

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
@@ -9817,7 +9817,7 @@ internal Task TdsExecuteRPC(SqlCommand cmd, IList<_SqlRPC> rpcArray, int timeout
98179817
int parametersLength = rpcext.userParamCount + rpcext.systemParamCount;
98189818

98199819
bool isAdvancedTraceOn = SqlClientEventSource.Log.IsAdvancedTraceOn();
9820-
bool enableOptimizedParameterBinding = cmd.EnableOptimizedParameterBinding;
9820+
bool enableOptimizedParameterBinding = cmd.EnableOptimizedParameterBinding && cmd.CommandType == CommandType.Text;
98219821

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

0 commit comments

Comments
 (0)