I am having a problem returning a default DateTime value from a complex Linq-to-Sql query.
Hopefully the following simplified example shows the
The error implies that t.TransactionTime is nullable (i.e. DateTime?). Even if the field can't be null in the database if the property is nullable and the query returns no rows FirstOrDefault() will return null as this is the default value of t.TransactionTime
EDIT
further to your comments, that is very strange: the below code outputs True
List dates = new List();
DateTime date = dates.FirstOrDefault();
Console.WriteLine(date == DateTime.MinValue);
And i would expect your code to do the same.