我正在使用visual studio 2013开发一个 MVC 5 应用程序,我创建了一个额外的用户配置文件表,它应该通过 userID 链接到aspnetusers表,其中包含来自这个链接: http://www.itorian.com/2013/11/customizing-users-profile-to-add-new.html ,但我尝试了几种不同的方法来链接这两个表,但是在调试时它不起作用,我的用户客户用户配置文件模型类如下:
public partial class User_Profile_Info
{
[Key]
public string User_ID { get; set; }
[Column(TypeName = "numeric")]
public decimal Agency_ID { get; set; }
[Required]
[StringLength(200)]
public string Username { get; set; }
[Column(TypeName = "numeric")]
public decimal? AccessLv_ID { get; set; }
[Required]
[StringLength(100)]
public string Password { get; set; }
[StringLength(10)]
public string Salutation { get; set; }
[StringLength(50)]
public string Firstname { get; set; }
[StringLength(50)]
public string Middlename { get; set; }
[StringLength(50)]
public string Lastname { get; set; }
[StringLength(50)]
public string JobTitle { get; set; }
[StringLength(20)]
public string Phone { get; set; }
[StringLength(20)]
public string Mobile { get; set; }
[StringLength(100)]
public string Email { get; set; }
[Column(TypeName = "text")]
public string PersonalQ1 { get; set; }
[Column(TypeName = "text")]
public string PersonalA1 { get; set; }
[Column(TypeName = "text")]
public string PersonalQ2 { get; set; }
[Column(TypeName = "text")]
public string PersonalA2 { get; set; }
[Column(TypeName = "text")]
public string PersonalQ3 { get; set; }
[Column(TypeName = "text")]
public string PersonalA3 { get; set; }
[Column(TypeName = "numeric")]
public decimal Status_ID { get; set; }
public DateTime Date_Created { get; set; }
public virtual Access_Levels Access_Levels { get; set; }
public virtual Agency Agency { get; set; }
public virtual AspNetUser AspNetUser { get; set; }
public virtual User_Status User_Status { get; set; }
}
我试图在SQL自定义配置文件表中设置外键以链接到aspnetusers表,但是在从代码首先映射到模型类之后的运行时出现错误,我只是想知道是否可以设置在没有使用Entity Framework的Code First Database Migration的情况下单独使用sql数据库的框架,只要双方匹配,因为当我尝试首先与代码集成两个表时,它遇到了各种错误并且需要很长时间而无法修复
我还是这个MVC ASP.NET身份系统的新手,请指教!