Entity Framework Core throws System.Data.SqlTypes.SqlNullValueException when loading entities from DbContext
问题 I have this MyEntity table in the database: The data inside MyEntity is the following: The EF Core entity is the following: public class MyEntity { public int Id { get; set; } public int MyInt { get; set; } } I am getting an exception: System.Data.SqlTypes.SqlNullValueException: 'Data is Null. This method or property cannot be called on Null values.' when trying to load the MyEntity from the DbContext : var myEntities = dbContext.Set<MyEntity>.ToList(); What am I doing wrong? 回答1: You are