@@ -1132,7 +1132,7 @@ internal enum Row
1132
1132
SingleOrDefault = 3
1133
1133
}
1134
1134
1135
- private static readonly int [ ] ErrTwoRows = new int [ 2 ] , ErrZeroRows = new int [ 0 ] ;
1135
+ private static readonly int [ ] ErrTwoRows = new int [ 2 ] , ErrZeroRows = Array . Empty < int > ( ) ;
1136
1136
private static void ThrowMultipleRows ( Row row )
1137
1137
{
1138
1138
switch ( row )
@@ -1214,7 +1214,7 @@ private static T QueryRowImpl<T>(IDbConnection cnn, Row row, ref CommandDefiniti
1214
1214
}
1215
1215
1216
1216
/// <summary>
1217
- /// Shared value deserilization path for QueryRowImpl and QueryRowAsync
1217
+ /// Shared value deserialization path for QueryRowImpl and QueryRowAsync
1218
1218
/// </summary>
1219
1219
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
1220
1220
private static T ReadRow < T > ( CacheInfo info , Identity identity , ref CommandDefinition command , Type effectiveType , IDataReader reader )
@@ -1429,7 +1429,7 @@ private static IEnumerable<TReturn> MultiMap<TFirst, TSecond, TThird, TFourth, T
1429
1429
private static IEnumerable < TReturn > MultiMapImpl < TFirst , TSecond , TThird , TFourth , TFifth , TSixth , TSeventh , TReturn > ( this IDbConnection cnn , CommandDefinition command , Delegate map , string splitOn , IDataReader reader , Identity identity , bool finalize )
1430
1430
{
1431
1431
object param = command . Parameters ;
1432
- identity = identity ?? new Identity < TFirst , TSecond , TThird , TFourth , TFifth , TSixth , TSeventh > ( command . CommandText , command . CommandType , cnn , typeof ( TFirst ) , param ? . GetType ( ) ) ;
1432
+ identity ??= new Identity < TFirst , TSecond , TThird , TFourth , TFifth , TSixth , TSeventh > ( command . CommandText , command . CommandType , cnn , typeof ( TFirst ) , param ? . GetType ( ) ) ;
1433
1433
CacheInfo cinfo = GetCacheInfo ( identity , param , command . AddToCache ) ;
1434
1434
1435
1435
IDbCommand ownedCommand = null ;
@@ -1499,7 +1499,7 @@ private static IEnumerable<TReturn> MultiMapImpl<TReturn>(this IDbConnection cnn
1499
1499
}
1500
1500
1501
1501
object param = command . Parameters ;
1502
- identity = identity ?? new IdentityWithTypes ( command . CommandText , command . CommandType , cnn , types [ 0 ] , param ? . GetType ( ) , types ) ;
1502
+ identity ??= new IdentityWithTypes ( command . CommandText , command . CommandType , cnn , types [ 0 ] , param ? . GetType ( ) , types ) ;
1503
1503
CacheInfo cinfo = GetCacheInfo ( identity , param , command . AddToCache ) ;
1504
1504
1505
1505
IDbCommand ownedCommand = null ;
@@ -2386,8 +2386,8 @@ internal static IList<LiteralToken> GetLiteralTokens(string sql)
2386
2386
public static Action < IDbCommand , object > CreateParamInfoGenerator ( Identity identity , bool checkForDuplicates , bool removeUnused ) =>
2387
2387
CreateParamInfoGenerator ( identity , checkForDuplicates , removeUnused , GetLiteralTokens ( identity . sql ) ) ;
2388
2388
2389
- private static bool IsValueTuple ( Type type ) => ( type ? . IsValueType == true
2390
- && type . FullName . StartsWith ( "System.ValueTuple`" , StringComparison . Ordinal ) )
2389
+ private static bool IsValueTuple ( Type type ) => ( type ? . IsValueType == true
2390
+ && type . FullName . StartsWith ( "System.ValueTuple`" , StringComparison . Ordinal ) )
2391
2391
|| ( type != null && IsValueTuple ( Nullable . GetUnderlyingType ( type ) ) ) ;
2392
2392
2393
2393
internal static Action < IDbCommand , object > CreateParamInfoGenerator ( Identity identity , bool checkForDuplicates , bool removeUnused , IList < LiteralToken > literals )
@@ -2410,7 +2410,7 @@ internal static Action<IDbCommand, object> CreateParamInfoGenerator(Identity ide
2410
2410
2411
2411
bool isStruct = type . IsValueType ;
2412
2412
var _sizeLocal = ( LocalBuilder ) null ;
2413
- LocalBuilder GetSizeLocal ( ) => _sizeLocal ?? ( _sizeLocal = il . DeclareLocal ( typeof ( int ) ) ) ;
2413
+ LocalBuilder GetSizeLocal ( ) => _sizeLocal ??= il . DeclareLocal ( typeof ( int ) ) ;
2414
2414
il . Emit ( OpCodes . Ldarg_1 ) ; // stack is now [untyped-param]
2415
2415
2416
2416
LocalBuilder typedParameterLocal ;
@@ -3055,7 +3055,7 @@ public static Func<IDataReader, object> GetTypeDeserializer(
3055
3055
private static LocalBuilder GetTempLocal ( ILGenerator il , ref Dictionary < Type , LocalBuilder > locals , Type type , bool initAndLoad )
3056
3056
{
3057
3057
if ( type == null ) throw new ArgumentNullException ( nameof ( type ) ) ;
3058
- locals = locals ?? new Dictionary < Type , LocalBuilder > ( ) ;
3058
+ locals ??= new Dictionary < Type , LocalBuilder > ( ) ;
3059
3059
if ( ! locals . TryGetValue ( type , out LocalBuilder found ) )
3060
3060
{
3061
3061
found = il . DeclareLocal ( type ) ;
@@ -3193,7 +3193,7 @@ private static void GenerateValueTupleDeserializer(Type valueTupleType, IDataRea
3193
3193
if ( nullableUnderlyingType != null )
3194
3194
{
3195
3195
var nullableTupleConstructor = valueTupleType . GetConstructor ( new [ ] { nullableUnderlyingType } ) ;
3196
-
3196
+
3197
3197
il . Emit ( OpCodes . Newobj , nullableTupleConstructor ) ;
3198
3198
}
3199
3199
@@ -3777,7 +3777,7 @@ private static string __ToStringRecycle(this StringBuilder obj)
3777
3777
{
3778
3778
if ( obj == null ) return "" ;
3779
3779
var s = obj . ToString ( ) ;
3780
- perThreadStringBuilderCache = perThreadStringBuilderCache ?? obj ;
3780
+ perThreadStringBuilderCache ??= obj ;
3781
3781
return s ;
3782
3782
}
3783
3783
}
0 commit comments