views:

165

answers:

0

I need to get a collection property populated in a DTO and I'm having trouble finding any information on doing this.

I tried to do it like this:

ICriteria selectCriteria = Session.CreateCriteria<DataRun>()
            .SetProjection(Projections.ProjectionList()
                .Add(Projections.Property("SomeCollection"), "Collection"))
            .SetResultTransformer(Transformers.AliasToBean<MyDto>());

but MyDto.Collection is always null. Am I doing this wrong, is this even possible?

Also, I had originally planned on doing this with a SubQuery so I could just fill my DTO's collection with other DTOs but this will not work because the result of the subquery has more than 1 row (as it should) and Sqlit does not like that (throws an exception). what is the right thing to do here?