Skip to content

Commit 0c1fdad

Browse files
authored
avoid duplicate dictionary lookup in GetSession (#4550)
1 parent 76cb322 commit 0c1fdad

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Source/Csla.AspNetCore/Blazor/State/SessionManager.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,8 @@ public class SessionManager(ISessionIdManager sessionIdManager) : ISessionManage
2626
/// </summary>
2727
public Session GetSession()
2828
{
29-
Session result;
3029
var key = _sessionIdManager.GetSessionId();
31-
if (!_sessions.ContainsKey(key))
32-
_sessions.TryAdd(key, []);
33-
result = _sessions[key];
30+
var result = _sessions.GetOrAdd(key, []);
3431
result.Touch();
3532
return result;
3633
}

0 commit comments

Comments
 (0)