小编Gan*_*esh的帖子

NullReferenceException:在ef7中添加DateTime列后,对象引用未设置为对象的实例

我是asp.net mvc ef 7的新手,试图从vb.net迁移.

我有一个课程如下

[Table("MatGrp")]
public class MatGrp
{
    [Key]
    public decimal Grp_RNo { get; set; }

    [Required]
    [MaxLength(30)]
    [Display(Name = "Group Code")]
    public string Grp_Code { get; set; }

    [Required]
    [MaxLength(100)]
    [Display(Name = "Group Name")]
    public string Grp_Name { get; set; }
    public decimal Cre_By { get; set; }
    public DateTime Cre_DtTm { get; set; }
    public decimal Mod_By { get; set; }
    [DataType(DataType.DateTime)]
    public System.DateTime Mod_DtTm { get; set; }

}
Run Code Online (Sandbox Code Playgroud)

我为这个类生成了一个控制器,如果我删除公共System.DateTime Mod_DtTm {get; 组; 来自该类的列,但添加此列会在此堆栈跟踪中显示错误

处理请求时发生未处理的异常. …

asp.net entity-framework-core

-1
推荐指数
1
解决办法
4441
查看次数

标签 统计

asp.net ×1

entity-framework-core ×1