Re: EF 6 GroupBy NullReferenceException
Posted by: Eugen Khudoliiv
Date: December 24, 2020 06:35AM

Yeah, sorry, I missed the orderby stmt, now examples should look like these:

var finalActivities = from examActivity in activitiesFilteredForReport
orderby examActivity.CreateTime descending
group examActivity by axamActivity.CreateTime into gr
select gr.FirstOrDefault();

I can't show SQL for this query, cause it fails even I call 'ToString()'

But if I write code like this:

var finalActivities = from examActivity in activitiesFilteredForReport
orderby examActivity.CreateTime descending
group examActivity by axamActivity.CreateTime into gr
select gr.FirstOrDefault().Id;

It gives me Ids without any exception.

Options: ReplyQuote


Subject
Written By
Posted
Re: EF 6 GroupBy NullReferenceException
December 24, 2020 06:35AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.