Code First using Visual Studio 2013 Template with Asp.网络身份不能



我在本教程中使用Code First更新我的AspNetUsers表。

http://blogs.msdn.com/b/webdev/archive/2013/10/16/customizing -概要信息- asp -净-认同- - vs - 2013 templates.aspx

This my 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")
        {
        }
    }
}

我已经做了这些步骤:

  • 启用镜像- OK
  • Add-Migration"鼓励性. ."
  • - database就

这个步骤正确执行(不是停止错误),但不改变任何东西。我遵循了所有的教程步骤,使用我的自定义数据,并调试数据发送ok跨视图模型,但数据库是问题所在。

我看到表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; }
}

最新更新