internal static void Unregister(RegisteredSessionComponent s) { if (s.Session == null) { return; } lock (_storage) { Dictionary <Type, RegisteredSessionComponent> dat; if (_storage.TryGetValue(s.Session, out dat)) { foreach (var k in s.RegisteredTypes) { if (dat.GetValueOrDefault(k) == s) { dat.Remove(k); } } if (dat.Count == 0) { _storage.Remove(s.Session); } } } }
internal static void Register(RegisteredSessionComponent s) { if (s.Session == null) { return; } lock (_storage) { Dictionary <Type, RegisteredSessionComponent> dat; if (!_storage.TryGetValue(s.Session, out dat)) { _storage.Add(s.Session, dat = new Dictionary <Type, RegisteredSessionComponent>()); } foreach (var k in s.RegisteredTypes) { dat[k] = s; } } }