MVC知识点3

72 阅读1分钟

1.MVC中,this指当前对象 2. 从后台直接读东西 [Display(Name="")] @Html.DisplayNameFor(model => model.Name) 3.为什么用? ,没有问号进不来 ,因为有些不能存储 4.MVC中find只需要传主键 5. 外键: public int StuInfoId { get; set; }或 [ForeignKey("StuInfoId")] 多对一: public StuInfo StuInfo { get; set; } 6. 主键 类名Id [key] null 可不可以存储null [Key] public StuInfo(){ Score =new HashSet(); }等价于 public virtual ICollection Collection { get; set; } = new HashSet();