冯 海

一个程序新人菜鸟的日记,希望大家多多关照。QQ:32316131

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)

  

posted @ 2017-05-08 15:15  秋天来了哟  阅读(509)  评论(0)    收藏  举报
认识就是缘份,愿天下人都快乐!
QQ: 32316131
Email: 32316131@qq.com