我是 MVC+EF 的新手
我需要一次将数据插入 3 个表,但无法弄清楚我该怎么做我的数据模型是
public class UserLogin
{
[Key]public int UserID { get; set; }
public string LoginName { get; set; }
public byte Password { get; set; }
}
public class UserDetails
{
[Key]
public int DetailID { get; set; }
[ForeignKey("UserLogin")]
public int UserID { get; set; }
public string UserName { get; set; }
public string Address { get; set; }
}
public class UserType
{
[Key]
public int TypeID { get; set; }
[ForeignKey("UserLogin")]
public int UserID { get; set; }
public string TypeName { get; set; }
public string TypeDiscription { get; set; }
}
public class UserBDCon : DbContext
{
public DbSet<UserLogin> logins { get; set; }
public DbSet<UserDetails> Detail { get; set; }
public DbSet<UserType> Type { get; set; }
}
谁能告诉我这个模型的控制器和视图文件如何?