views:

217

answers:

1

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 that matter.

+1  A: 

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.

Jon Seigel