concept dto in category .net

This is an excerpt from Manning's book Entity Framework 4 in Action.
Create a CustomerDTO class, a data transfer object (DTO) class, containing only the data needed for communication, and expose it to the client. This approach works really well. You just need to create an ad hoc class (a DTO), pour data into it when reading the Customer entity, and pour data from it to the Customer entity when updating the database (not updating the WS* properties). This way, you have a much cleaner design, with the only drawback being that you need to maintain one more class. But remember that T4 templates can help you generate such classes. Just create a custom property (as you did in the Add/Attach example in chapter 13) that states whether the entity property must be included in the DTO, and then create a template that generates the DTO for you. If this doesn’t make you fall in love with T4, nothing will. The class you expose to the client is known as the contract. Choosing what type of contract to expose to the client isn’t strictly related to Entity Framework; it’s more related to application design. Nonetheless, choosing whether to send the full entity or a DTO to the client has an impact on how you work with Entity Framework.
A DTO is a standalone class used only for communication purposes. By creating a DTO, you can easily control what data is sent to the client. In fact, customizing entities to add serialization attributes can be a real pain due to the complexity of modifying the EDM and template (unless you generate the model once, modify it manually, and never regenerate it ... but that’s an extremely improbable scenario).
Creating a DTO for the Customer class is just a matter of creating a class containing the properties you need to expose to the client. You can create and maintain such a class manually, but nothing prevents you from using custom annotations in the EDM and a template to generate the class. The DTO class is simple, as you see in this listing.

This is an excerpt from Manning's book NHibernate in Action.
Another solution is to use NHibernate to query data and fill a DataSet with the result. This operation can be done manually by writing code similar to that required for DTOs, but it becomes tedious when you’re dealing with numerous entities. In this case, code generation can help greatly simplify the process.
DTOs are commonly used to totally separate the presentation tier from the domain model. Certain reasonable arguments can be made in favor of this approach, but you shouldn’t mistake these arguments for the real reason why DTOs are useful.