开发者

NHibernate and DTOs

开发者 https://www.devze.com 2022-12-08 15:33 出处:网络
I am considering bringing NHibernate into a project but have a question on how read only DTOs would be implemented. Entities are easy, but what about scenarios where you have a field our two from mult

I am considering bringing NHibernate into a project but have a question on how read only DTOs would be implemented. Entities are easy, but what about scenarios where you have a field our two from multiple entities/tables that need to be mashed together for display data on a view. Surely it would be overkill to load up all of the entities and then create the DTO. Especially when, gasp, a hand written query mapped to a DTO, would be much more efficient.

How do you guys deal with this scenario when using NH, or any orm for tha开发者_JAVA百科t matter.


With NHibernate, you can transform/project query results from different objects onto the same DTO.

Here is a question I answered not too long ago about DTOs. You just have to extend what I wrote to work with multiple objects.

0

精彩评论

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

关注公众号