Represents an active account session.
Ejemplo n.º 1
0
        /// <inheritdoc />
        public bool TryRegisterSession(int accountId, out int sessionId)
        {
            if (_activeAccounts.ContainsKey(accountId))
            {
                sessionId = 0;
                return(false);
            }
            else
            {
                sessionId = _currentSessionId.Increment();

                var account = new ActiveAccount(accountId, sessionId);
                account.KeepAlive(_clock.Now);

                _activeAccounts.Add(accountId, account);
                return(true);
            }
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        public bool TryRegisterSession(int accountId, out int sessionId)
        {
            if (this.activeAccounts.ContainsKey(accountId))
            {
                sessionId = 0;
                return false;
            }
            else
            {
                sessionId = this.currentSessionId.Increment();

                var account = new ActiveAccount(accountId, sessionId);
                account.KeepAlive(this.clock.Now);

                this.activeAccounts.Add(accountId, account);
                return true;
            }
        }