/// <summary>
        /// Gets the user, if any, associated with the specified, normalized email address.
        /// </summary>
        /// <param name="normalizedEmail">The normalized email address to return the user for.</param>
        /// <param name="cancellationToken">
        /// The <see cref="CancellationToken"/> used to propagate notifications that the operation
        /// should be canceled.
        /// </param>
        /// <returns>
        /// The task object containing the results of the asynchronous lookup operation, the user if
        /// any associated with the specified normalized email address.
        /// </returns>
        public override async Task <TUser> FindByEmailAsync(string normalizedEmail, CancellationToken cancellationToken = default)
        {
            ThrowIfDisposed();
            cancellationToken.ThrowIfCancellationRequested();

            var grain = await _client.Find <IIdentityUserGrain <TUser, TRole> >(OrleansIdentityConstants.EmailLookup, normalizedEmail);

            if (grain != null)
            {
                return(await grain.Get());
            }

            return(null);
        }
Пример #2
0
        /// <summary>
        /// Finds the role who has the specified normalized name as an asynchronous operation.
        /// </summary>
        /// <param name="normalizedRoleName">The normalized role name to look for.</param>
        /// <param name="cancellationToken">
        /// The <see cref="CancellationToken"/> used to propagate notifications that the operation
        /// should be canceled.
        /// </param>
        /// <returns>A <see cref="Task{TResult}"/> that result of the look up.</returns>
        public async Task <TRole> FindByNameAsync(string normalizedRoleName, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            ThrowIfDisposed();

            var grain = await _client.Find <IIdentityRoleGrain <TUser, TRole> >(OrleansIdentityConstants.RoleLookup, normalizedRoleName);

            if (grain != null)
            {
                return(await grain.Get());
            }

            return(null);
        }