Asp.net identity IUserEmailStore是否保存到数据库或实体?
我正在编写一个自定义的Asp.net identity IUserEmailStore是否保存到数据库或实体?,asp.net-identity,Asp.net Identity,我正在编写一个自定义的UserStore(T)实现,以便与旧的数据库模式进行交互。我的IUserEmailStore.SetEmailAsync实现应该将此更改保存到数据库还是只在用户实体上设置电子邮件?换句话说,标识系统在调用此方法后是否调用UpdateAsync?用户管理器在设置电子邮件后是否调用UpdateAsync public virtual async Task<IdentityResult> SetEmailAsync(TKey userId, string email
UserStore(T)
实现,以便与旧的数据库模式进行交互。我的IUserEmailStore.SetEmailAsync
实现应该将此更改保存到数据库还是只在用户实体上设置电子邮件?换句话说,标识系统在调用此方法后是否调用UpdateAsync
?用户管理器在设置电子邮件后是否调用UpdateAsync
public virtual async Task<IdentityResult> SetEmailAsync(TKey userId, string email)
{
ThrowIfDisposed();
var store = GetEmailStore();
var user = await FindByIdAsync(userId).WithCurrentCulture();
if (user == null)
{
throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, Resources.UserIdNotFound,
userId));
}
await store.SetEmailAsync(user, email).WithCurrentCulture();
await store.SetEmailConfirmedAsync(user, false).WithCurrentCulture();
await UpdateSecurityStampInternal(user).WithCurrentCulture();
return await UpdateAsync(user).WithCurrentCulture();
}
公共虚拟异步任务SetEmailAsync(TKey用户ID,字符串电子邮件)
{
ThrowIfDisposed();
var store=GetEmailStore();
var user=wait FindByIdAsync(userId).WithCurrentCulture();
if(user==null)
{
抛出新的InvalidOperationException(String.Format(CultureInfo.CurrentCulture,Resources.UserIdNotFound,
用户ID);
}
wait store.SetEmailAsync(用户,电子邮件).WithCurrentCulture();
wait store.SetEmailConfirmedAsync(用户,false).WithCurrentCulture();
等待更新安全StampInternal(用户).WithCurrentCulture();
返回wait wait updatesync(用户).WithCurrentCulture();
}
因此,您的商店只需要将电子邮件设置在用户对象上(而不是保存)。这就是我需要知道的。谢谢