前天做了一个MVC Entity FrameWork项目,遇到有外键关联的数据编辑问题。当你编辑的时候,按照正常的逻辑,把每个字段的数据都对号入座了,然后点击保存按钮,本以为会顺理成章的编辑数据,但是EF却与众不同,它就是不如你所愿,当你查看数据列表的时候,你会发现列表中莫名其妙的又多了一条数据。很是蛋疼啊。

实体类

    public class DeviceViewControl
    {
        public int ID { get; set; } //控件ID
        public DeviceView DeviceView { get; set; } //所在视图ID
        public DeviceSensorPoint DeviceSensorPoint { get; set; } //对应感控点ID
        public string ViewControlClassName { get; set; } //控件类名称
        public string ViewControlPosition { get; set; } //控件位置
        public string Remark { get; set; } //备注
    }
实体类1(主键表)

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-03
  • 2022-12-23
  • 2021-05-18
  • 2021-11-20
猜你喜欢
  • 2022-12-23
  • 2022-01-27
  • 2022-12-23
  • 2021-09-02
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案