Hi
Is it possible to use projections and the criteria API to create
hierarchical objects? For example, I currently have an type called
attribute count which contains 3 values
Class AttributeCount
Public TypeID As Integer
Public Value As String
Public Count As Integer
End Class
I'm able to retrieve this using projections as shown below
GetSession().CreateCriteria("Product", "P").CreateAlias("Attributes",
"A") _
.SetProjection(Projections.ProjectionList() _
.Add(Projections.GroupProperty
("A.Type"), "Type") _
.Add(Projections.GroupProperty
("A.ValueData"), "Value") _
.Add(Projections.Count("P.ProductID"),
"Count") _
) _
.SetResultTransformer(Transformers.AliasToBean
(GetType(AttributeCount)))
However, I really want my domain model to be
Class AttributeTypeCount
Public TypeID As Integer
Public Values As IList(Of AttributeCount)
End Class
Class AttributeCount
Public Value As String
Public Count As Integer
End Class
Is it possible to create this using projections?
Thanks
James
--
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.