Umair Ahmed
Umair Ahmed

Reputation: 11696

How to transform an entity into composite dto? (Fluent Nhibernate)

I was exploring Nhibernate and have come across a problem.

I have the following Entities.

Entities

And the corresponding Dto for them

Dtos

Now using the following query I am trying transform the Orders into Orderdto

select o
  FROM Order o
  join o.OrderItems
  join o.Customer

The following transformation is not working probably because of Order being a composite type.

var query = session.GetNamedQuery("GetOrderSummaries")
            .SetResultTransformer(Transformers.AliasToBean<OrderItemDto>());

Any out of box transformation available for such situations?

Upvotes: 0

Views: 880

Answers (1)

UpTheCreek
UpTheCreek

Reputation: 32401

Personally I would use AutoMapper for this, rather than doing it in Nhibernate/Fluent (whether or not it was possible).

Upvotes: 1

Related Questions