@@ -10078,20 +10078,24 @@ internal Task TdsExecuteRPC(SqlCommand cmd, _SqlRPC[] rpcArray, int timeout, boo
10078
10078
10079
10079
ParameterDirection parameterDirection = param.Direction;
10080
10080
10081
- // Throw an exception if ForceColumnEncryption is set on a parameter and the ColumnEncryption is not enabled on SqlConnection or SqlCommand
10082
- if (param.ForceColumnEncryption &&
10083
- !(cmd.ColumnEncryptionSetting == SqlCommandColumnEncryptionSetting.Enabled ||
10084
- (cmd.ColumnEncryptionSetting == SqlCommandColumnEncryptionSetting.UseConnectionSetting && cmd.Connection.IsColumnEncryptionSettingEnabled)))
10081
+ if (param.ForceColumnEncryption)
10085
10082
{
10086
- throw SQL.ParamInvalidForceColumnEncryptionSetting(param.ParameterName, rpcext.GetCommandTextOrRpcName());
10087
- }
10083
+ // Throw an exception if ForceColumnEncryption is set on a parameter and the ColumnEncryption is not enabled on SqlConnection or SqlCommand
10084
+ if (
10085
+ !(cmd.ColumnEncryptionSetting == SqlCommandColumnEncryptionSetting.Enabled
10086
+ ||
10087
+ (cmd.ColumnEncryptionSetting == SqlCommandColumnEncryptionSetting.UseConnectionSetting && cmd.Connection.IsColumnEncryptionSettingEnabled))
10088
+ )
10089
+ {
10090
+ throw SQL.ParamInvalidForceColumnEncryptionSetting(param.ParameterName, rpcext.GetCommandTextOrRpcName());
10091
+ }
10088
10092
10089
- // Check if the applications wants to force column encryption to avoid sending sensitive data to server
10090
- if (param.ForceColumnEncryption && param.CipherMetadata == null
10091
- && (parameterDirection == ParameterDirection.Input || parameterDirection == ParameterDirection.InputOutput))
10092
- {
10093
- // Application wants a parameter to be encrypted before sending it to server, however server doesnt think this parameter needs encryption.
10094
- throw SQL.ParamUnExpectedEncryptionMetadata(param.ParameterName, rpcext.GetCommandTextOrRpcName());
10093
+ // Check if the applications wants to force column encryption to avoid sending sensitive data to server
10094
+ if (param.CipherMetadata == null && (parameterDirection == ParameterDirection.Input || parameterDirection == ParameterDirection.InputOutput))
10095
+ {
10096
+ // Application wants a parameter to be encrypted before sending it to server, however server doesnt think this parameter needs encryption.
10097
+ throw SQL.ParamUnExpectedEncryptionMetadata(param.ParameterName, rpcext.GetCommandTextOrRpcName());
10098
+ }
10095
10099
}
10096
10100
10097
10101
if (enableOptimizedParameterBinding && (parameterDirection == ParameterDirection.Output || parameterDirection == ParameterDirection.InputOutput))
0 commit comments