@@ -111,7 +111,7 @@ public static Task<T> QuerySingleOrDefaultAsync<T>(this IDbConnection cnn, strin
111111 /// </summary>
112112 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 )
113113 {
114- if ( type == null ) throw new ArgumentNullException ( nameof ( type ) ) ;
114+ if ( type == null ) throw new ArgumentNullException ( " type" ) ;
115115 return QueryAsync < object > ( cnn , type , new CommandDefinition ( sql , param , transaction , commandTimeout , commandType , CommandFlags . Buffered , default ( CancellationToken ) ) ) ;
116116 }
117117
@@ -120,31 +120,31 @@ public static Task<IEnumerable<object>> QueryAsync(this IDbConnection cnn, Type
120120 /// </summary>
121121 public static Task < object > QueryFirstAsync ( this IDbConnection cnn , Type type , string sql , object param = null , IDbTransaction transaction = null , int ? commandTimeout = null , CommandType ? commandType = null )
122122 {
123- if ( type == null ) throw new ArgumentNullException ( nameof ( type ) ) ;
123+ if ( type == null ) throw new ArgumentNullException ( " type" ) ;
124124 return QueryRowAsync < object > ( cnn , Row . First , type , new CommandDefinition ( sql , param , transaction , commandTimeout , commandType , CommandFlags . None , default ( CancellationToken ) ) ) ;
125125 }
126126 /// <summary>
127127 /// Execute a single-row query asynchronously using .NET 4.5 Task.
128128 /// </summary>
129129 public static Task < object > QueryFirstOrDefaultAsync ( this IDbConnection cnn , Type type , string sql , object param = null , IDbTransaction transaction = null , int ? commandTimeout = null , CommandType ? commandType = null )
130130 {
131- if ( type == null ) throw new ArgumentNullException ( nameof ( type ) ) ;
131+ if ( type == null ) throw new ArgumentNullException ( " type" ) ;
132132 return QueryRowAsync < object > ( cnn , Row . FirstOrDefault , type , new CommandDefinition ( sql , param , transaction , commandTimeout , commandType , CommandFlags . None , default ( CancellationToken ) ) ) ;
133133 }
134134 /// <summary>
135135 /// Execute a single-row query asynchronously using .NET 4.5 Task.
136136 /// </summary>
137137 public static Task < object > QuerySingleAsync ( this IDbConnection cnn , Type type , string sql , object param = null , IDbTransaction transaction = null , int ? commandTimeout = null , CommandType ? commandType = null )
138138 {
139- if ( type == null ) throw new ArgumentNullException ( nameof ( type ) ) ;
139+ if ( type == null ) throw new ArgumentNullException ( " type" ) ;
140140 return QueryRowAsync < object > ( cnn , Row . Single , type , new CommandDefinition ( sql , param , transaction , commandTimeout , commandType , CommandFlags . None , default ( CancellationToken ) ) ) ;
141141 }
142142 /// <summary>
143143 /// Execute a single-row query asynchronously using .NET 4.5 Task.
144144 /// </summary>
145145 public static Task < object > QuerySingleOrDefaultAsync ( this IDbConnection cnn , Type type , string sql , object param = null , IDbTransaction transaction = null , int ? commandTimeout = null , CommandType ? commandType = null )
146146 {
147- if ( type == null ) throw new ArgumentNullException ( nameof ( type ) ) ;
147+ if ( type == null ) throw new ArgumentNullException ( " type" ) ;
148148 return QueryRowAsync < object > ( cnn , Row . SingleOrDefault , type , new CommandDefinition ( sql , param , transaction , commandTimeout , commandType , CommandFlags . None , default ( CancellationToken ) ) ) ;
149149 }
150150
@@ -205,7 +205,7 @@ private static Task<DbDataReader> ExecuteReaderWithFlagsFallbackAsync(DbCommand
205205 private static async Task < IEnumerable < T > > QueryAsync < T > ( this IDbConnection cnn , Type effectiveType , CommandDefinition command )
206206 {
207207 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 ) ;
209209 var info = GetCacheInfo ( identity , param , command . AddToCache ) ;
210210 bool wasClosed = cnn . State == ConnectionState . Closed ;
211211 var cancel = command . CancellationToken ;
@@ -267,7 +267,7 @@ private static async Task<IEnumerable<T>> QueryAsync<T>(this IDbConnection cnn,
267267 private static async Task < T > QueryRowAsync < T > ( this IDbConnection cnn , Row row , Type effectiveType , CommandDefinition command )
268268 {
269269 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 ) ;
271271 var info = GetCacheInfo ( identity , param , command . AddToCache ) ;
272272 bool wasClosed = cnn . State == ConnectionState . Closed ;
273273 var cancel = command . CancellationToken ;
@@ -452,7 +452,7 @@ private static async Task<int> ExecuteMultiImplAsync(IDbConnection cnn, CommandD
452452 }
453453 private static async Task < int > ExecuteImplAsync ( IDbConnection cnn , CommandDefinition command , object param )
454454 {
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 ) ;
456456 var info = GetCacheInfo ( identity , param , command . AddToCache ) ;
457457 bool wasClosed = cnn . State == ConnectionState . Closed ;
458458 using ( var cmd = ( DbCommand ) command . SetupCommand ( cnn , info . ParamReader ) )
@@ -645,7 +645,7 @@ public static Task<IEnumerable<TReturn>> QueryAsync<TFirst, TSecond, TThird, TFo
645645 private static async Task < IEnumerable < TReturn > > MultiMapAsync < TFirst , TSecond , TThird , TFourth , TFifth , TSixth , TSeventh , TReturn > ( this IDbConnection cnn , CommandDefinition command , Delegate map , string splitOn )
646646 {
647647 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 ) } ) ;
649649 var info = GetCacheInfo ( identity , param , command . AddToCache ) ;
650650 bool wasClosed = cnn . State == ConnectionState . Closed ;
651651 try
@@ -693,7 +693,7 @@ private static async Task<IEnumerable<TReturn>> MultiMapAsync<TReturn>(this IDbC
693693 }
694694
695695 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 ) ;
697697 var info = GetCacheInfo ( identity , param , command . AddToCache ) ;
698698 bool wasClosed = cnn . State == ConnectionState . Closed ;
699699 try {
@@ -718,7 +718,8 @@ private static IEnumerable<T> ExecuteReaderSync<T>(IDataReader reader, Func<IDat
718718 yield return ( T ) func ( reader ) ;
719719 }
720720 while ( reader . NextResult ( ) ) { }
721- ( parameters as IParameterCallbacks ) ? . OnCompleted ( ) ;
721+ var callbacks = parameters as IParameterCallbacks ;
722+ if ( callbacks != null ) callbacks . OnCompleted ( ) ;
722723 }
723724 }
724725
@@ -739,7 +740,7 @@ public static Task<GridReader> QueryMultipleAsync(
739740 public static async Task < GridReader > QueryMultipleAsync ( this IDbConnection cnn , CommandDefinition command )
740741 {
741742 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 ) ;
743744 CacheInfo info = GetCacheInfo ( identity , param , command . AddToCache ) ;
744745
745746 DbCommand cmd = null ;
@@ -833,7 +834,7 @@ private static async Task<IDataReader> ExecuteReaderImplAsync(IDbConnection cnn,
833834 finally
834835 {
835836 if ( wasClosed ) cnn . Close ( ) ;
836- cmd ? . Dispose ( ) ;
837+ if ( cmd != null ) cmd . Dispose ( ) ;
837838 }
838839 }
839840
@@ -903,7 +904,7 @@ private static async Task<T> ExecuteScalarImplAsync<T>(IDbConnection cnn, Comman
903904 finally
904905 {
905906 if ( wasClosed ) cnn . Close ( ) ;
906- cmd ? . Dispose ( ) ;
907+ if ( cmd != null ) cmd . Dispose ( ) ;
907908 }
908909 return Parse < T > ( result ) ;
909910 }
0 commit comments