User1870205858 posted
I'm new to Entity Framework and I'm getting a null reference error that I'm not sure how to resolve.
In my DBContext class, in the onModelCreating method, I'm binding the database columns to the class that I am using.
My database column is called "cancelled_date" and my class property is "CancelledDate". My query that is returning the data has some records with null values in this column.
Here's my code snippet in the onModelCreating method:
...
entity.Property(e => e.CancelledDate)
.HasColumnName("cancelled_date")
.HasColumnType("datetime");
...
What attribute do I need to add to check for nulls? I tried putting a try/catch around this, but that did not work.
Any suggestions? Thanks!