【问题标题】:Unable to add to property column in entity framework无法添加到实体框架中的属性列
【发布时间】:2017-08-30 13:03:44
【问题描述】:

我使用名为 Recordings 的表使用代码优先迁移创建了一个数据库。但是,除非我手动更新了迁移文件,否则没有将 1 个属性 (RecordingType) 添加到数据库中。这一切都很好,但是当我运行 .Add(Recording) 方法时,该列没有更新。有什么想法吗?

【问题讨论】:

  • 你可以为你的模型发布代码吗?
  • 我的猜测:不支持的数据类型。没有看到适当的细节就不可能说出来。
  • 需要将 RecordType 设置为属性,而不是字段。我的错。

标签: asp.net-mvc entity-framework ef-code-first


【解决方案1】:

对答案如此简单感到非常恼火: public int RecordType; 没有被 EntityFramework 接收,而是应该被 public int RecordType{get;set;} 很抱歉浪费了大家的时间。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-27
    • 1970-01-01
    • 2011-05-26
    • 2011-04-27
    • 1970-01-01
    相关资源
    最近更新 更多