Okay. I got it working, but VERY INEFFICIENT. There got be a better way to do this.
So just for the sake of to make it work at least, I modified the query to just return a list of "dicussions objects", instead of scalar values like in the previous post and bind it to a repeater
Code:
IList<JumptreeForum_Discussions> discussions = session.CreateQuery("from JumptreeForum_Discussions discussion").List<JumptreeForum_Discussions>();
as you can see, this way, each row of the repeater will be a "JumptreeForum_Discussion" object, no more array of objects (System.Object[])
and then my repeater simply do
Code:
<asp:Repeater ID="Test" runat="server">
<ItemTemplate>
<%#Eval("DiscussionID")%>/ <%#Eval("Comments.Count") %> <br />
</ItemTemplate>
</asp:Repeater>
where "Comments" is a IList Comments that I have in my JumptreeForum_Discussions class. By doing the "Comments.Count", I'm actually lazy loading the comments collection for that dicussion, get everything back and do a count on the returned collection.
This is inefficent for sure. In my previous query, I got everything with 1 sql query that I can see in my log file.
In the current query, I have 20 discussions and each of them have, comments, because I'm lazy loading the "comments" when I want to do "Count" on them, I see 20 queries performed.
I mean I guess it's not that big of a deal if say I set the paging site to 50 or 100. But still, I must not be doing it right.
Somebody got any good suggestions?? I'm a newbie, Please help.