@@ -111,7 +111,7 @@ public static Task<T> QuerySingleOrDefaultAsync<T>(this IDbConnection cnn, strin
111
111
/// </summary>
112
112
public static Task < IEnumerable < object > > QueryAsync ( this IDbConnection cnn , Type type , string sql , object param = null , IDbTransaction transaction = null , int ? commandTimeout = null , CommandType ? commandType = null )
113
113
{
114
- if ( type == null ) throw new ArgumentNullException ( nameof ( type ) ) ;
114
+ if ( type == null ) throw new ArgumentNullException ( " type" ) ;
115
115
return QueryAsync < object > ( cnn , type , new CommandDefinition ( sql , param , transaction , commandTimeout , commandType , CommandFlags . Buffered , default ( CancellationToken ) ) ) ;
116
116
}
117
117
@@ -120,31 +120,31 @@ public static Task<IEnumerable<object>> QueryAsync(this IDbConnection cnn, Type
120
120
/// </summary>
121
121
public static Task < object > QueryFirstAsync ( this IDbConnection cnn , Type type , string sql , object param = null , IDbTransaction transaction = null , int ? commandTimeout = null , CommandType ? commandType = null )
122
122
{
123
- if ( type == null ) throw new ArgumentNullException ( nameof ( type ) ) ;
123
+ if ( type == null ) throw new ArgumentNullException ( " type" ) ;
124
124
return QueryRowAsync < object > ( cnn , Row . First , type , new CommandDefinition ( sql , param , transaction , commandTimeout , commandType , CommandFlags . None , default ( CancellationToken ) ) ) ;
125
125
}
126
126
/// <summary>
127
127
/// Execute a single-row query asynchronously using .NET 4.5 Task.
128
128
/// </summary>
129
129
public static Task < object > QueryFirstOrDefaultAsync ( this IDbConnection cnn , Type type , string sql , object param = null , IDbTransaction transaction = null , int ? commandTimeout = null , CommandType ? commandType = null )
130
130
{
131
- if ( type == null ) throw new ArgumentNullException ( nameof ( type ) ) ;
131
+ if ( type == null ) throw new ArgumentNullException ( " type" ) ;
132
132
return QueryRowAsync < object > ( cnn , Row . FirstOrDefault , type , new CommandDefinition ( sql , param , transaction , commandTimeout , commandType , CommandFlags . None , default ( CancellationToken ) ) ) ;
133
133
}
134
134
/// <summary>
135
135
/// Execute a single-row query asynchronously using .NET 4.5 Task.
136
136
/// </summary>
137
137
public static Task < object > QuerySingleAsync ( this IDbConnection cnn , Type type , string sql , object param = null , IDbTransaction transaction = null , int ? commandTimeout = null , CommandType ? commandType = null )
138
138
{
139
- if ( type == null ) throw new ArgumentNullException ( nameof ( type ) ) ;
139
+ if ( type == null ) throw new ArgumentNullException ( " type" ) ;
140
140
return QueryRowAsync < object > ( cnn , Row . Single , type , new CommandDefinition ( sql , param , transaction , commandTimeout , commandType , CommandFlags . None , default ( CancellationToken ) ) ) ;
141
141
}
142
142
/// <summary>
143
143
/// Execute a single-row query asynchronously using .NET 4.5 Task.
144
144
/// </summary>
145
145
public static Task < object > QuerySingleOrDefaultAsync ( this IDbConnection cnn , Type type , string sql , object param = null , IDbTransaction transaction = null , int ? commandTimeout = null , CommandType ? commandType = null )
146
146
{
147
- if ( type == null ) throw new ArgumentNullException ( nameof ( type ) ) ;
147
+ if ( type == null ) throw new ArgumentNullException ( " type" ) ;
148
148
return QueryRowAsync < object > ( cnn , Row . SingleOrDefault , type , new CommandDefinition ( sql , param , transaction , commandTimeout , commandType , CommandFlags . None , default ( CancellationToken ) ) ) ;
149
149
}
150
150
@@ -205,7 +205,7 @@ private static Task<DbDataReader> ExecuteReaderWithFlagsFallbackAsync(DbCommand
205
205
private static async Task < IEnumerable < T > > QueryAsync < T > ( this IDbConnection cnn , Type effectiveType , CommandDefinition command )
206
206
{
207
207
object param = command . Parameters ;
208
- var identity = new Identity ( command . CommandText , command . CommandType , cnn , effectiveType , param ? . GetType ( ) , null ) ;
208
+ var identity = new Identity ( command . CommandText , command . CommandType , cnn , effectiveType , param != null ? param . GetType ( ) : null , null ) ;
209
209
var info = GetCacheInfo ( identity , param , command . AddToCache ) ;
210
210
bool wasClosed = cnn . State == ConnectionState . Closed ;
211
211
var cancel = command . CancellationToken ;
@@ -267,7 +267,7 @@ private static async Task<IEnumerable<T>> QueryAsync<T>(this IDbConnection cnn,
267
267
private static async Task < T > QueryRowAsync < T > ( this IDbConnection cnn , Row row , Type effectiveType , CommandDefinition command )
268
268
{
269
269
object param = command . Parameters ;
270
- var identity = new Identity ( command . CommandText , command . CommandType , cnn , effectiveType , param ? . GetType ( ) , null ) ;
270
+ var identity = new Identity ( command . CommandText , command . CommandType , cnn , effectiveType , param != null ? param . GetType ( ) : null , null ) ;
271
271
var info = GetCacheInfo ( identity , param , command . AddToCache ) ;
272
272
bool wasClosed = cnn . State == ConnectionState . Closed ;
273
273
var cancel = command . CancellationToken ;
@@ -452,7 +452,7 @@ private static async Task<int> ExecuteMultiImplAsync(IDbConnection cnn, CommandD
452
452
}
453
453
private static async Task < int > ExecuteImplAsync ( IDbConnection cnn , CommandDefinition command , object param )
454
454
{
455
- var identity = new Identity ( command . CommandText , command . CommandType , cnn , null , param ? . GetType ( ) , null ) ;
455
+ var identity = new Identity ( command . CommandText , command . CommandType , cnn , null , param != null ? param . GetType ( ) : null , null ) ;
456
456
var info = GetCacheInfo ( identity , param , command . AddToCache ) ;
457
457
bool wasClosed = cnn . State == ConnectionState . Closed ;
458
458
using ( var cmd = ( DbCommand ) command . SetupCommand ( cnn , info . ParamReader ) )
@@ -645,7 +645,7 @@ public static Task<IEnumerable<TReturn>> QueryAsync<TFirst, TSecond, TThird, TFo
645
645
private static async Task < IEnumerable < TReturn > > MultiMapAsync < TFirst , TSecond , TThird , TFourth , TFifth , TSixth , TSeventh , TReturn > ( this IDbConnection cnn , CommandDefinition command , Delegate map , string splitOn )
646
646
{
647
647
object param = command . Parameters ;
648
- var identity = new Identity ( command . CommandText , command . CommandType , cnn , typeof ( TFirst ) , param ? . GetType ( ) , new [ ] { typeof ( TFirst ) , typeof ( TSecond ) , typeof ( TThird ) , typeof ( TFourth ) , typeof ( TFifth ) , typeof ( TSixth ) , typeof ( TSeventh ) } ) ;
648
+ var identity = new Identity ( command . CommandText , command . CommandType , cnn , typeof ( TFirst ) , param != null ? param . GetType ( ) : null , new [ ] { typeof ( TFirst ) , typeof ( TSecond ) , typeof ( TThird ) , typeof ( TFourth ) , typeof ( TFifth ) , typeof ( TSixth ) , typeof ( TSeventh ) } ) ;
649
649
var info = GetCacheInfo ( identity , param , command . AddToCache ) ;
650
650
bool wasClosed = cnn . State == ConnectionState . Closed ;
651
651
try
@@ -693,7 +693,7 @@ private static async Task<IEnumerable<TReturn>> MultiMapAsync<TReturn>(this IDbC
693
693
}
694
694
695
695
object param = command . Parameters ;
696
- var identity = new Identity ( command . CommandText , command . CommandType , cnn , types [ 0 ] , param ? . GetType ( ) , types ) ;
696
+ var identity = new Identity ( command . CommandText , command . CommandType , cnn , types [ 0 ] , param != null ? param . GetType ( ) : null , types ) ;
697
697
var info = GetCacheInfo ( identity , param , command . AddToCache ) ;
698
698
bool wasClosed = cnn . State == ConnectionState . Closed ;
699
699
try {
@@ -718,7 +718,8 @@ private static IEnumerable<T> ExecuteReaderSync<T>(IDataReader reader, Func<IDat
718
718
yield return ( T ) func ( reader ) ;
719
719
}
720
720
while ( reader . NextResult ( ) ) { }
721
- ( parameters as IParameterCallbacks ) ? . OnCompleted ( ) ;
721
+ var callbacks = parameters as IParameterCallbacks ;
722
+ if ( callbacks != null ) callbacks . OnCompleted ( ) ;
722
723
}
723
724
}
724
725
@@ -739,7 +740,7 @@ public static Task<GridReader> QueryMultipleAsync(
739
740
public static async Task < GridReader > QueryMultipleAsync ( this IDbConnection cnn , CommandDefinition command )
740
741
{
741
742
object param = command . Parameters ;
742
- Identity identity = new Identity ( command . CommandText , command . CommandType , cnn , typeof ( GridReader ) , param ? . GetType ( ) , null ) ;
743
+ Identity identity = new Identity ( command . CommandText , command . CommandType , cnn , typeof ( GridReader ) , param != null ? param . GetType ( ) : null , null ) ;
743
744
CacheInfo info = GetCacheInfo ( identity , param , command . AddToCache ) ;
744
745
745
746
DbCommand cmd = null ;
@@ -833,7 +834,7 @@ private static async Task<IDataReader> ExecuteReaderImplAsync(IDbConnection cnn,
833
834
finally
834
835
{
835
836
if ( wasClosed ) cnn . Close ( ) ;
836
- cmd ? . Dispose ( ) ;
837
+ if ( cmd != null ) cmd . Dispose ( ) ;
837
838
}
838
839
}
839
840
@@ -903,7 +904,7 @@ private static async Task<T> ExecuteScalarImplAsync<T>(IDbConnection cnn, Comman
903
904
finally
904
905
{
905
906
if ( wasClosed ) cnn . Close ( ) ;
906
- cmd ? . Dispose ( ) ;
907
+ if ( cmd != null ) cmd . Dispose ( ) ;
907
908
}
908
909
return Parse < T > ( result ) ;
909
910
}
0 commit comments