Represents an active account session.
Example #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);
            }
        }
Example #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;
            }
        }