开发者

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.

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

And the corresponding Dto for them

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

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 s开发者_Go百科uch situations?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜