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.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---