Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }