コード例 #1
0
        /// <inheritdoc/>
        protected override async Task <TUser> FindUserAsync(TKey userId, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            ThrowIfDisposed();
            var user = await UsersTable.FindByIdAsync(userId);

            return(user);
        }
コード例 #2
0
        /// <inheritdoc/>
        public override async Task <TUser> FindByIdAsync(string userId, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            ThrowIfDisposed();
            var id   = ConvertIdFromString(userId);
            var user = await UsersTable.FindByIdAsync(id);

            return(user);
        }
コード例 #3
0
        public override async Task <ApplicationUser <TKey> > FindByIdAsync(string userId, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            ThrowIfDisposed();
            if (string.IsNullOrEmpty(userId))
            {
                throw new ArgumentException($"Parameter {nameof(userId)} cannot be null or empty.");
            }

            return(await UsersTable.FindByIdAsync(ConvertIdFromString(userId)));
        }
コード例 #4
0
        public Task <ApplicationUser> FindByIdAsync(string userId, CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.ThrowIfCancellationRequested();
            //var isValidGuid = Guid.TryParse(userId, out var userGuid);
            //
            //if (!isValidGuid) {
            //    return Task.FromResult<ApplicationUser>(null);
            //}

            return(_usersTable.FindByIdAsync(userId));
        }
コード例 #5
0
        public Task <ApplicationUser> FindByIdAsync(string userId, CancellationToken cancellationToken)
        {
            bool isValidGuid = Guid.TryParse(userId, out Guid userGuid);

            if (!isValidGuid)
            {
                return(Task.FromResult <ApplicationUser>(null));
            }

            cancellationToken.ThrowIfCancellationRequested();
            return(_usersTable.FindByIdAsync(userGuid));
        }
コード例 #6
0
 protected override async Task <ApplicationUser <TKey> > FindUserAsync(TKey userId, CancellationToken cancellationToken)
 {
     cancellationToken.ThrowIfCancellationRequested();
     ThrowIfDisposed();
     return(await UsersTable.FindByIdAsync(userId));
 }