@@ -73,12 +73,13 @@ public static DbCommand AddParameter(this DbCommand command, string id, string v
73
73
/// <summary>
74
74
/// Adds a parameter to the call (for all types other than strings)
75
75
/// </summary>
76
+ /// <param name="command">Command object</param>
76
77
/// <param name="id">Name of the parameter</param>
78
+ /// <param name="type">SQL type of the parameter</param>
77
79
/// <param name="value">Value to add</param>
78
80
/// <param name="direction">Direction that the parameter goes (in or out)</param>
79
- /// <param name="command">Command object</param>
80
- /// <param name="type">SQL type of the parameter</param>
81
81
/// <returns>The DbCommand object</returns>
82
+ /// <exception cref="ArgumentNullException">command or id</exception>
82
83
public static DbCommand AddParameter ( this DbCommand command , string id , SqlDbType type ,
83
84
object value = null , ParameterDirection direction = ParameterDirection . Input )
84
85
{
@@ -93,11 +94,12 @@ public static DbCommand AddParameter(this DbCommand command, string id, SqlDbTyp
93
94
/// Adds a parameter to the call (for all types other than strings)
94
95
/// </summary>
95
96
/// <typeparam name="DataType">Data type of the parameter</typeparam>
96
- /// <param name="id">Name of the parameter</param>
97
- /// <param name="direction">Direction that the parameter goes (in or out)</param>
98
97
/// <param name="command">Command object</param>
98
+ /// <param name="id">Name of the parameter</param>
99
99
/// <param name="value">Value to add</param>
100
+ /// <param name="direction">Direction that the parameter goes (in or out)</param>
100
101
/// <returns>The DbCommand object</returns>
102
+ /// <exception cref="ArgumentNullException">command or id</exception>
101
103
public static DbCommand AddParameter < DataType > ( this DbCommand command , string id , DataType value = default ( DataType ) ,
102
104
ParameterDirection direction = ParameterDirection . Input )
103
105
{
@@ -113,12 +115,13 @@ public static DbCommand AddParameter(this DbCommand command, string id, SqlDbTyp
113
115
/// <summary>
114
116
/// Adds a parameter to the call (for all types other than strings)
115
117
/// </summary>
116
- /// <param name="id">Name of the parameter</param>
117
- /// <param name="direction">Direction that the parameter goes (in or out)</param>
118
118
/// <param name="command">Command object</param>
119
- /// <param name="value">Value to add </param>
119
+ /// <param name="id">Name of the parameter </param>
120
120
/// <param name="type">SQL type of the parameter</param>
121
+ /// <param name="value">Value to add</param>
122
+ /// <param name="direction">Direction that the parameter goes (in or out)</param>
121
123
/// <returns>The DbCommand object</returns>
124
+ /// <exception cref="ArgumentNullException">command or id</exception>
122
125
public static DbCommand AddParameter ( this DbCommand command , string id , DbType type , object value = null ,
123
126
ParameterDirection direction = ParameterDirection . Input )
124
127
{
@@ -157,8 +160,7 @@ public static DbTransaction BeginTransaction(this DbCommand command, int retries
157
160
/// <returns>The DBCommand object</returns>
158
161
public static DbCommand ClearParameters ( this DbCommand command )
159
162
{
160
- if ( command ? . Parameters != null )
161
- command . Parameters . Clear ( ) ;
163
+ command ? . Parameters ? . Clear ( ) ;
162
164
return command ;
163
165
}
164
166
@@ -185,8 +187,7 @@ public static DbCommand Close(this DbCommand command)
185
187
/// <returns>The DBCommand object</returns>
186
188
public static DbCommand Commit ( this DbCommand command )
187
189
{
188
- if ( command ? . Transaction != null )
189
- command . Transaction . Commit ( ) ;
190
+ command ? . Transaction ? . Commit ( ) ;
190
191
return command ;
191
192
}
192
193
@@ -226,8 +227,8 @@ public static DbCommand Commit(this DbCommand command)
226
227
/// <summary>
227
228
/// Gets a parameter or creates it, if it is not found
228
229
/// </summary>
229
- /// <param name="id">Name of the parameter</param>
230
230
/// <param name="command">Command object</param>
231
+ /// <param name="id">Name of the parameter</param>
231
232
/// <returns>The DbParameter associated with the ID</returns>
232
233
public static DbParameter GetOrCreateParameter ( this DbCommand command , string id )
233
234
{
@@ -248,8 +249,8 @@ public static DbParameter GetOrCreateParameter(this DbCommand command, string id
248
249
/// Returns an output parameter's value
249
250
/// </summary>
250
251
/// <typeparam name="DataType">Data type of the object</typeparam>
251
- /// <param name="id">Parameter name</param>
252
252
/// <param name="command">Command object</param>
253
+ /// <param name="id">Parameter name</param>
253
254
/// <param name="defaultValue">Default value for the parameter</param>
254
255
/// <returns>
255
256
/// if the parameter exists (and isn't null or empty), it returns the parameter's value.
@@ -299,8 +300,7 @@ public static DbCommand Open(this DbCommand command, int retries = 0)
299
300
/// <returns>The DBCommand object</returns>
300
301
public static DbCommand Rollback ( this DbCommand command )
301
302
{
302
- if ( command ? . Transaction != null )
303
- command . Transaction . Rollback ( ) ;
303
+ command ? . Transaction ? . Rollback ( ) ;
304
304
return command ;
305
305
}
306
306
}
0 commit comments