예제 #1
0
        public override async Task <IdentityRole <TKey> > FindByIdAsync(string id, CancellationToken cancellationToken = default)
        {
            cancellationToken.ThrowIfCancellationRequested();
            ThrowIfDisposed();

            if (string.IsNullOrEmpty(id))
            {
                throw new ArgumentException($"Parameter {nameof(id)} cannot be null or empty.");
            }

            return(await RolesTable.FindByIdAsync(id));
        }
예제 #2
0
        public Task <ApplicationRole> FindByIdAsync(string roleId, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            roleId.ThrowIfNull(nameof(roleId));
            var isValIdGuId = Guid.TryParse(roleId, out var roleGuId);

            if (!isValIdGuId)
            {
                throw new ArgumentException("Parameter roleId is not a valId Guid.", nameof(roleId));
            }

            return(_rolesTable.FindByIdAsync(roleGuId));
        }
예제 #3
0
        public Task <ApplicationRole> FindByIdAsync(string roleId, CancellationToken cancellationToken)
        {
            if (string.IsNullOrEmpty(roleId))
            {
                throw new ArgumentNullException(nameof(roleId), "Parameter roleId cannot be null or empty.");
            }

            bool isValidGuid = Guid.TryParse(roleId, out Guid roleGuid);

            if (!isValidGuid)
            {
                throw new ArgumentException("Parameter roleId is not a valid Guid.", nameof(roleId));
            }

            cancellationToken.ThrowIfCancellationRequested();
            return(_rolesTable.FindByIdAsync(roleGuid));
        }