Linq to Entities, getting Max date when there is no data?

Up vote 1 down vote favorite share g+ share fb share tw.

Here's my statement: startDate = (from n in db. Nodes where n. SeedID == mySeedID select n.

CreatedDate).Max(); It works fine when there is data for that SeedID. However, some times the seed is new, so there are no nodes. The statement results in an InvalidOperationException.

I could wrap this in try/catch. Is there a better way to deal with this scenario? Linq-to-entities entity-framework-4.1 link|improve this question asked Oct 3 '11 at 17:44King Julian67828 50% accept rate.

StartDate = (from n in db. Nodes where n. SeedID == mySeedID select (DateTime?

)n. CreatedDate).Max().

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions