码迷,mamicode.com
首页 > Web开发 > 详细

ASP.NET Identity 修改表名和主键类型

时间:2016-05-22 22:51:59      阅读:1284      评论:0      收藏:0      [点我收藏+]

标签:

    public class UserLogin : IdentityUserLogin<Guid>
    {
    }

    public class UserRole : IdentityUserRole<Guid>
    {
    }

    public class UserClaim : IdentityUserClaim<Guid>
    {
    }

    public class Role : IdentityRole<Guid, UserRole>
    {
    }

    public class User : IdentityUser<Guid, UserLogin, UserRole, UserClaim>
    {
    }


public class XYZDbContext : IdentityDbContext<User, Role, Guid, UserLogin, UserRole, UserClaim> { /// <summary>
        /// 构造函数 /// </summary>
        public XYZDbContext () : base("XYZDbContext ") { } /// <summary>
        /// 在模型创建时 /// </summary>
        /// <param name="modelBuilder">模型构建器</param>
        protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); // 配置实体类型映射到的表名
            modelBuilder.Entity<User>().ToTable("User"); modelBuilder.Entity<Role>().ToTable("Role"); modelBuilder.Entity<UserLogin>().ToTable("UserLogin"); modelBuilder.Entity<UserClaim>().ToTable("UserClaim"); modelBuilder.Entity<UserRole>().ToTable("UserRole"); } }

ASP.NET Identity 修改表名和主键类型

标签:

原文地址:http://www.cnblogs.com/zhyp/p/5517963.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!