Skip to content

Commit 981cfe4

Browse files
DamirAinullinmgravell
authored andcommitted
Replaced ContainsKey and [] with TryGetValue (#1339)
1 parent d12f1aa commit 981cfe4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Dapper.Contrib/SqlMapperExtensions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -541,9 +541,9 @@ private static ISqlAdapter GetFormatter(IDbConnection connection)
541541
var name = GetDatabaseType?.Invoke(connection).ToLower()
542542
?? connection.GetType().Name.ToLower();
543543

544-
return !AdapterDictionary.ContainsKey(name)
545-
? DefaultAdapter
546-
: AdapterDictionary[name];
544+
return AdapterDictionary.TryGetValue(name, out var adapter)
545+
? adapter
546+
: DefaultAdapter;
547547
}
548548

549549
private static class ProxyGenerator

0 commit comments

Comments
 (0)