コード例 #1
0
        public async Task <IdentityResult> DeleteAsync(TUser user,
                                                       CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.ThrowIfCancellationRequested();

            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }

            cancellationToken.ThrowIfCancellationRequested();

            TableOperation executeOperation = TableOperation.Delete(user);

            try
            {
                TableResult result = await AuthCloudTable.ExecuteAsync(executeOperation, cancellationToken);
            }
            catch (Exception ex)
            {
                throw new Exception($"Failed deleting user {user.RowKey}", ex);
            }

            return(IdentityResult.Success);
        }
コード例 #2
0
        public async Task <IdentityResult> UpdateAsync(TUser user, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }

            cancellationToken.ThrowIfCancellationRequested();

            TableOperation executeOperation = TableOperation.Replace(user);

            try
            {
                await AuthCloudTable.ExecuteAsync(executeOperation, cancellationToken);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
            return(IdentityResult.Success);
        }