示例#1
0
        public Task <IdentityResult> CreateAsync(ApplicationRole role, CancellationToken cancellationToken)
        {
            if (role == null)
            {
                throw new ArgumentNullException(nameof(role), "Parameter role is not set to an instance of an object.");
            }

            return(_rolesTable.CreateAsync(role, cancellationToken));
        }
示例#2
0
        public override async Task <IdentityResult> CreateAsync(IdentityRole <TKey> role, CancellationToken cancellationToken = default)
        {
            cancellationToken.ThrowIfCancellationRequested();
            ThrowIfDisposed();
            role.ThrowIfNull(nameof(role));

            var created = await RolesTable.CreateAsync(role);

            return(created ? IdentityResult.Success : IdentityResult.Failed(new IdentityError {
                Description = $"Role '{role.Name}' could not be created."
            }));
        }
 public Task <IdentityResult> CreateAsync(ApplicationRole role, CancellationToken cancellationToken)
 {
     cancellationToken.ThrowIfCancellationRequested();
     role.ThrowIfNull(nameof(role));
     return(_rolesTable.CreateAsync(role));
 }