I think this is a new "moda" because more than one is asking for this...Try
to think about this
select hf.Id, hf.FamilyName,  hf.Pets from HumanFamily hf

The RDBMS SQL allow only 2 dimensional result so ...
SELECT hf.Id, hf.FamilyName, pet.* FROM HumanFamily hf JOIN Animal a on
a.OwnerId = hf.Id

Now somebody should say to NH how create a on-the-fly-KeyObject of hf.Id,
hf.FamilyName, with its Equals and GetHashCode implemented, and group all
result by this new anonymous object and return a IDictionary<anonymous,
IList<Animal>>.

Instead do it so complicated you can simple do something like
from HumanFamily hf join fetch hf.Pets
Then, using LINQ, transform the result in what you want in a single code
line (or so).

2009/5/16 mantzas <[email protected]>

>
> HI,
>
> given a Class lets say
>
> public class User
> {
>        public virtual int Id {get;set;}
>        public virtual IList<ProjectGroup> ProjectGroups{get;set;}
> }
>
> and a DTO
>
> public class UserDTO
> {
>        public int Id {get;set;}
>        publicIList<ProjectGroupDTO> ProjectGroups{get;set;}
> }
>
> i want to project the results from the User to UserDTO.
>
> DetachedCriteria dc = DetachedCriteria.For(typeof (User));
> dc.CreateAlias("ProjectGroups", "pg");
> dc.SetProjection(Projections.ProjectionList()
>                             .Add(Projections.Property("Id"),"Id")
>                             .Add(Projections.Property
> ("User.UserGroups"), ));
>
> dc.SetResultTransformer(Transformers.AliasToBean(typeof (UserDTO)));
>
> something is missing or simply i dont get it!!!
>
> Can someone please guide me???
>
> Thx
>
>
>
>
>
>
>
>
> >
>


-- 
Fabio Maulo

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

Reply via email to