using System; using System.Collections.Generic; namespace EmbedIO.Sessions.Internal { internal sealed class DummySessionProxy : ISessionProxy { private DummySessionProxy() { } public static ISessionProxy Instance { get; } = new DummySessionProxy(); public bool Exists => false; /// public string Id => throw NoSessionManager(); /// public TimeSpan Duration => throw NoSessionManager(); /// public DateTime LastActivity => throw NoSessionManager(); /// public int Count => 0; /// public bool IsEmpty => true; /// public object this[string key] { get => throw NoSessionManager(); set => throw NoSessionManager(); } /// public void Delete() { } /// public void Regenerate() => throw NoSessionManager(); /// public void Clear() { } /// public bool ContainsKey(string key) => throw NoSessionManager(); /// public bool TryGetValue(string key, out object value) => throw NoSessionManager(); /// public bool TryRemove(string key, out object value) => throw NoSessionManager(); /// public IReadOnlyList> TakeSnapshot() => throw NoSessionManager(); private InvalidOperationException NoSessionManager() => new InvalidOperationException("No session manager registered in the web server."); } }