NHibernate AliasToBeanResultTransformer & Collections

I would like to return a DTO from my data layer, which will also contain child collections ... for example:

Audio
 - Title
 - Description
 - Filename
 - Tags
     -  TagName
 - Comments
     -  PersonName
     -  CommentText

Here is a basic request so far, but I'm not sure how to convert child collections from my object to DTO.

var query = Session.CreateCriteria<Audio>("audio")
            .SetProjection(
                Projections.ProjectionList()
                    .Add(Projections.Property<Audio>(x => x.Title))
                    .Add(Projections.Property<Audio>(x => x.Description))
                    .Add(Projections.Property<Audio>(x => x.Filename))
            ).SetResultTransformer(new AliasToBeanResultTransformer(typeof(AudioDto)))
            .List<AudioDto>();

Is this possible, or is there another recommended way to do this?

UPDATE : I just want to add a little more information about my script ... I want to return a list of audio elements for the current user to the system, as well as some related objects such as tags, comments, etc .... they are pretty straightforward using MultiQuery / Future.

However, when displaying audio elements to the user, I also want to display the user 3 other options:

  • Weather they added this audio element to their favorites list
  • , 'thumbs up'
  • - " " .
Favourites : Audio -> HasMany -> AudioUserFavourites

Thumbs Up : Audio -> HasManyToMany -> UserAccount

Following Owner : Audio -> References -> UserAccount ->

ManyToMany → UserAccount

, ... ... ? 20.

Batch fetching, , , , , .

: -)

+3
1

Audio Tags Comments, Aydende Rahien: http://ayende.com/blog/4367/eagerly-loading-entity-associations-efficiently-with-nhibernate.

DTO ; Audio , . ; , , , . , Audio; NHibernate Audio , .

; - , , , .

+2

All Articles