【发布时间】:2015-02-24 21:43:57
【问题描述】:
我已经按照这里的教程进行操作:Customizing profile information in ASP.NET Identity in VS 2013 templates
并且完全按照那里的内容进行操作,除了我的新属性是一个名为“TaxId”的字符串。令人惊讶的是,当我执行“添加迁移”部分时,迁移文件出现了空:
namespace Mvc5Test.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class TaxId : DbMigration
{
public override void Up()
{
}
public override void Down()
{
}
}
}
知道为什么会发生这种情况以及修复它的正确方法是什么? (我想避免手动更新迁移文件...)
编辑:
public class ApplicationUser : IdentityUser
{
public string TaxId { get; set; }
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;
}
}
【问题讨论】:
-
你能说明你是如何扩展
IdentityUser的吗? -
@Ofiris 我刚刚编辑了问题以显示我扩展
IdentityUser的方式
标签: asp.net-mvc entity-framework asp.net-mvc-5 entity-framework-migrations