Example #1
0
        public async Task <bool> TryBeginSessionAsync(Session session, DateTime leaseEnd, CancellationToken cancellation)
        {
            if (session == default)
            {
                throw new ArgumentDefaultException(nameof(session));
            }

            var newSession = _storedSessionManager.Begin(session, leaseEnd);

            var previousSession = await _storage.UpdateSessionAsync(newSession, null, cancellation);

            return(previousSession == null);
        }