【发布时间】:2016-08-21 06:40:24
【问题描述】:
我首先使用代码来使用 mvc.net 开发 Web 应用程序。 我已经像这样向 IdentityUser 添加了两个字段
public class ApplicationUser : IdentityUser
{
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
{
// Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
// Add custom user claims here
return userIdentity;
}
public string ScreenName { get; set; }
public string UserType { get; set; }
}
我在我的第一个控制器上使用这个字段
UserId = User.Identity.GetUserId(),
NewUserId = Genrate.GenrateUserId(),
NewUserIdWithString = "Unspecified"
除此之外,所有应用程序都可以正常工作,但我不知道添加这些内容后,没有任何效果,它说,datacontext 已更改,可能存在/是另一个问题/s。
【问题讨论】:
标签: asp.net-mvc entity-framework code-first entity-framework-migrations