mvc5 identity AspNetUsers 表扩展字段
MVC5 执行数据库迁移时,会生成一些默认的数据表,但是在实际的工作中。若用到的时候,难免要增添一些字段。
注意下面的方法,自动建成的字段,除了string全部不能为非空,所以需要变为
public DateTime? CreateTime { get; set; }
public int? xxId { get; set; }
1.AspNetUsers 增加字段
A.打开MVC中的 IdentityModels.cs 文件,具体代码如下:
public class ApplicationUser : IdentityUser
{
#region 添加字段
public string IsUser { get; set; }
public string Tel { get; set; }
public DateTime CreateTime { get; set; }
public DateTime UpdateTime { get; set; }
#endregion
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
浙公网安备 33010602011771号