@@ -30,7 +30,7 @@ internal SqlCommandSet() : base()
30
30
_commandList = new List < SqlBatchCommand > ( ) ;
31
31
}
32
32
33
- private SqlCommand BatchCommand
33
+ internal SqlCommand BatchCommand
34
34
{
35
35
get
36
36
{
@@ -45,7 +45,7 @@ private SqlCommand BatchCommand
45
45
46
46
internal int CommandCount => CommandList . Count ;
47
47
48
- private List < SqlBatchCommand > CommandList
48
+ internal List < SqlBatchCommand > CommandList
49
49
{
50
50
get
51
51
{
@@ -98,24 +98,16 @@ internal void Append(SqlCommand command)
98
98
{
99
99
ADP . CheckArgumentNull ( command , nameof ( command ) ) ;
100
100
SqlClientEventSource . Log . TryTraceEvent ( "SqlCommandSet.Append | API | Object Id {0}, Command '{1}', Parameter Count {2}" , ObjectID , command . ObjectID , command . Parameters . Count ) ;
101
+
102
+ // SqlCommandSet only supports commands of type Text or StoredProcedure. This aligns with SqlCommand (validated by its CommandType setter.)
103
+ Debug . Assert ( command . CommandType is CommandType . Text or CommandType . StoredProcedure ) ;
104
+
101
105
string cmdText = command . CommandText ;
102
106
if ( string . IsNullOrEmpty ( cmdText ) )
103
107
{
104
108
throw ADP . CommandTextRequired ( nameof ( Append ) ) ;
105
109
}
106
110
107
- CommandType commandType = command . CommandType ;
108
- switch ( commandType )
109
- {
110
- case CommandType . Text :
111
- case CommandType . StoredProcedure :
112
- break ;
113
- case CommandType . TableDirect :
114
- throw SQL . NotSupportedCommandType ( commandType ) ;
115
- default :
116
- throw ADP . InvalidCommandType ( commandType ) ;
117
- }
118
-
119
111
SqlParameterCollection parameters = null ;
120
112
121
113
SqlParameterCollection collection = command . Parameters ;
@@ -279,7 +271,7 @@ internal bool GetBatchedAffected(int commandIdentifier, out int recordsAffected,
279
271
internal int GetParameterCount ( int commandIndex )
280
272
=> CommandList [ commandIndex ] . Parameters . Count ;
281
273
282
- private void ValidateCommandBehavior ( string method , CommandBehavior behavior )
274
+ internal void ValidateCommandBehavior ( string method , CommandBehavior behavior )
283
275
{
284
276
if ( 0 != ( behavior & ~ ( CommandBehavior . SequentialAccess | CommandBehavior . CloseConnection ) ) )
285
277
{
0 commit comments