一、问题描述:
Unhandled Exception: : Data is Null. This method or property cannot be called on Null values.
at .get_DateTime()
at (Int32 i)
二、原因分析:
EF Core模型读到日期为Null的字段。
三、解决方案:
1、设置日期为可空类型
public class Student
{
public int Id { get; set; }
// public DateTime Entry_Date { get; set; }
public DateTime? Entry_Date { get; set; }
}
2、修改数据。