entity framework 5 datetime is null or empty

c#, datetime, entity-framework-5

Solution

If your property is Nullable (`DateTime?`) then you can check if it has value. You may define your property as Nullable. e.g.

public DateTime? DateProperty { get; set; }

Problem

I have a table, which generated to class, lets call it "MyClass" ,which has an DateTime Property. I want to check if an object of this property has value, just similar to DateTime.HasValue. I was wondering if EF5 has an option of HasValue or I should just check if MyClassInstance.MyDateTimeProp is null . Thanks

Original source