When I was looking to solve same problem I've found somewhere mentioned that
this is not possible. Current Linq implementation also isn't supporting it.

Still looking forward for a possible solution...

On Thu, Mar 19, 2009 at 7:59 AM, Jan Van Ryswyck
<jan.van.rysw...@gmail.com>wrote:

>
> Thx for the example.
>
> However, I've been looking how to project the collection of Category
> objects to a collection of CatalogDTO for the same DetachedCriteria. I
> don't know if that is possible?
>
>
> On Mar 18, 10:30 pm, Dario Quintana <conta...@darioquintana.com.ar>
> wrote:
> > Hi
> > Here you've an example:
> http://unhaddins.googlecode.com/svn/trunk/Examples/uNHAddins.Examples...http://unhaddins.googlecode.com/svn/trunk/Examples/uNHAddins.Examples.
> ..
> >
> > Cheers
> >
> > On Wed, Mar 18, 2009 at 5:22 PM, Jan Van Ryswyck
> > <jan.van.rysw...@gmail.com>wrote:
> >
> >
> >
> >
> >
> > > I have a question about using projections on collections. Suppose I
> > > have the following domain classes:
> >
> > > public class Catalog
> > > {
> > >    public IEnumerable<Category> Categories { get; set; }
> > >    public String Name { get; set; }
> > > }
> >
> > > public class Category
> > > {
> > >    public String Name { get; set; }
> > > }
> >
> > > that I want to project to the following DTO's:
> >
> > > public class CatalogDTO
> > > {
> > >    public IEnumerable<CategoryDTO> Categories { get; set; }
> > >    public String Name { get; set; }
> > > }
> >
> > > public class CategoryDTO
> > > {
> > >    public String Name { get; set; }
> > > }
> >
> > > The name property of the Catalog is quite easy, but I don't know how
> > > to do the Categories:
> >
> > > DetachedCriteria.For<Catalog>()
> > >                .CreateAlias("Categories", "categories")
> > >                .SetProjection(Projections.ProjectionList()
> > >                                   .Add(Projections.Property("Name"),
> > > "Name"))
> > >                .SetResultTransformer(Transformers.AliasToBean(typeof
> > > (CatalogDTO)));
> >
> > > Should I create a ProjectionList inside the current ProjectionList for
> > > the Categories? Any thoughts? Thanks in advance.
> >
> > --
> > Dario Quintanahttp://darioquintana.com.ar
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to nhusers@googlegroups.com
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to