public override async Task RemoveLoginAsync(ApplicationUser <TKey> user, string loginProvider, string providerKey, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); ThrowIfDisposed(); user.ThrowIfNull(nameof(user)); UserLogins ??= (await UserLoginsTable.GetLoginsAsync(user.Id)).ToList(); var userLogin = await FindUserLoginAsync(user.Id, loginProvider, providerKey, cancellationToken); if (userLogin != null) { UserLogins.Remove(userLogin); } }
/// <summary> /// Removes the <paramref name="loginProvider"/> given from the specified <paramref name="user"/>. /// </summary> /// <param name="user">The user to remove the login from.</param> /// <param name="loginProvider">The login to remove from the user.</param> /// <param name="providerKey">The key provided by the <paramref name="loginProvider"/> to identify a user.</param> /// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param> /// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns> public override async Task RemoveLoginAsync(User user, string loginProvider, string providerKey, CancellationToken cancellationToken = default(CancellationToken)) { cancellationToken.ThrowIfCancellationRequested(); ThrowIfDisposed(); if (user == null) { throw new ArgumentNullException(nameof(user)); } var entry = await FindUserLoginAsync(user.Id, loginProvider, providerKey, cancellationToken); if (entry != null) { UserLogins.Remove(entry); } }
private void FindDeletedChildren() { var removedUserAccountInfo = UserAccountInfos .Local .Where(x => x.User == null) .ToList(); var removedUserAddresses = UserAddresses .Local .Where(x => x.User == null) .ToList(); var removedUserEmails = UserEmails .Local .Where(x => x.User == null) .ToList(); var removedUserLogins = UserLogins .Local .Where(x => x.User == null) .ToList(); var removedUserPhones = UserPhones .Local .Where(x => x.User == null) .ToList(); try { Configuration.AutoDetectChangesEnabled = false; removedUserAccountInfo.ForEach(x => UserAccountInfos.Remove(x)); removedUserAddresses.ForEach(x => UserAddresses.Remove(x)); removedUserEmails.ForEach(x => UserEmails.Remove(x)); removedUserLogins.ForEach(x => UserLogins.Remove(x)); removedUserPhones.ForEach(x => UserPhones.Remove(x)); } finally { Configuration.AutoDetectChangesEnabled = true; } }