开发者

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

开发者 https://www.devze.com 2023-02-24 07:09 出处:网络
I was exploring Nhibernate and have come across a problem. I have the following Entities. And the corresponding Dto for them

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

精彩评论

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