Nobody??? :-(
On Feb 10, 12:48 am, reach4thelasers <[email protected]>
wrote:
> Hey guys,
>
> I am having problems expressing a query in Linq to NH. Basically, I
> have a discussion forum. On the home page I want to display the
> threads that have been discussed the most in the last week; not the
> threads with the most posts overall - the ones with the most posts in
> the last week.
>
> I can do it easy in SQL like so:
> select threadid, COUNT(*) from dbo.forummessages where date >
> '02/07/2009' group by threadid order by 2 desc
>
> but I can't seem to be able to express it in LINQ - can anyone help me
> out?
>
> Here is my best effort:
> var newthreads = from m in forumMessageDao.Messages
> where m.Date > DateTime.Now.AddDays(-7)
> group m by m.Thread
> into t orderby t.Count() select new {Thread = t.Key,
> PostsThisWeek = t.Count()};
>
> but I get an exception could not resolve property: Key of:
> Core.Domain.ForumMessage
>
> Any ideas?
>
> Kevin.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---