我在ASP.NET MVC 3 Web应用程序中使用实体框架“代码优先”方法。在我的数据库中,我有几个计算列。我需要使用这些列来显示数据(工作正常)。实体框架代码第一个计算属性
但是当我来到行插入这个表,我发现了以下错误:
The column "ChargePointText" cannot be modified because it is either a computed column or is the result of a UNION operator.
有没有办法在我的课为只读标记属性?
public class Tariff
{
public int TariffId { get; set; }
public int Seq { get; set; }
public int TariffType { get; set; }
public int TariffValue { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public int ChargePoint { get; set; }
public string ChargePointText { get; set; }
}
是的,你是对的 - 我的回答是不正确的。只有当你想让EF生成数据库时,它才能工作。将更新发布为答案并接受它。 – 2011-05-16 09:39:53