Query Objects + Child Collections

35 views
Skip to first unread message

Paul Hinett

unread,
Nov 4, 2011, 8:31:04 AM11/4/11
to sharp-arc...@googlegroups.com

Hi,

 

I am starting to get a grip of using Query Objects in my project, however I am unsure of how to return a list of child collections into my view model.

 

I want to return a list of ‘Audio’ entities flattened into a list of ‘AudioViewModel’ objects…however I also need a list of ‘Tracks’ associated with each Audio into a ‘TrackViewModel’ collection.

 

How would I do this?

 

Thank You,

Paul

Chris Richards

unread,
Nov 4, 2011, 9:12:19 PM11/4/11
to sharp-arc...@googlegroups.com
Isn't this the same problem as you asked before reqarding Questions and Answers? Just replace Question with Audio, and Answer with Track.
See https://gist.github.com/1298222 for the QueryOver example.

Chris

Paul Hinett

unread,
Nov 7, 2011, 7:16:23 AM11/7/11
to sharp-arc...@googlegroups.com

Well not exactly no, last time I was returning  a single question which had multiple answers so it was fairly simple to do 2 queries and join the answers after.

 

This time I have multiple Questions with multiple Answers…answers this time is a many-to-many.

 

It may be something obvious that I am over thinking, just need a shove in the right direction.

 

Thank You.

--
You received this message because you are subscribed to the Google Groups "S#arp Architecture" group.
To view this discussion on the web visit https://groups.google.com/d/msg/sharp-architecture/-/Fpkh2NFjzBAJ.
To post to this group, send email to sharp-arc...@googlegroups.com.
To unsubscribe from this group, send email to sharp-architect...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sharp-architecture?hl=en.

Chris Richards

unread,
Nov 7, 2011, 7:58:02 AM11/7/11
to sharp-arc...@googlegroups.com
The gist example will return a list of QuestionViewModels.
BTW - I've just updated the gist to fix some syntax errors and add a return value.

Chris

07 November 2011 12:16
05 November 2011 01:12
Isn't this the same problem as you asked before reqarding Questions and Answers? Just replace Question with Audio, and Answer with Track.
See https://gist.github.com/1298222 for the QueryOver example.

Chris

--
You received this message because you are subscribed to the Google Groups "S#arp Architecture" group.
To view this discussion on the web visit https://groups.google.com/d/msg/sharp-architecture/-/Fpkh2NFjzBAJ.
To post to this group, send email to sharp-arc...@googlegroups.com.
To unsubscribe from this group, send email to sharp-architect...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sharp-architecture?hl=en.
04 November 2011 12:31
--
You received this message because you are subscribed to the Google Groups "S#arp Architecture" group.
Reply all
Reply to author
Forward
0 new messages