我正在本教程中使用Code First更新我的AspNetUsers表。
这是我的IdentityModelClass:
using Microsoft.AspNet.Identity.EntityFramework;
using System;
using System.Data.Entity;
namespace MTGWeb.Models
{
// You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
public class ApplicationUser : IdentityUser
{
public String Pais;
public String Email;
public DateTime UltimoLogin;
public DateTime FechaRegistro;
public String Tipo;
public Boolean Activado;
}
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("DefaultConnection")
{
}
}
}
我已经执行了以下步骤:
- 启用任务-确定
- 添加迁移“ BlaBla ..”
- 更新数据库
此步骤可以正确执行(不会因错误而停止),但不会更改任何内容。我遵循了所有教程步骤,使用了自定义数据,并调试了数据,使其在各个视图模型之间都可以正常发送,但是数据库是问题所在。
我看到了表AspNetUsers,并且没有保存任何字段。有任何想法吗?我可以注册用户,但只能保存默认数据(Id, Username, PasswordHash,SecurityStamp and Discriminator
)
实体框架将属性映射到列。现在,它们是字段。像这样将它们更改为自动属性...
public class ApplicationUser : IdentityUser
{
public String Pais { get; set; }
public String Email { get; set; }
public DateTime UltimoLogin { get; set; }
public DateTime FechaRegistro { get; set; }
public String Tipo { get; set; }
public Boolean Activado { get; set; }
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句