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.
精彩评论