Lately I\'ve been hearing a lot about DTOs and how useful they are but I can\'t find a good example of using it in ASP.NET context.
Let\'s say I use three tier architect
An approach that I'm particularly fond of is to the DTO conversion in your Business Layer.
Scenario: Your Presentation Layer calls your Business Layer passing a DTO. You do some logic & validation, then convert the DTO to an entity and send it to your Data Access Layer.
i.e. UI --> Bus. Layer (convert to Entity) --> Data Layer
I like this approach as I believe the Data Layer should not have any conversion logic and should receive and handle entities as needed. Another reason why this is effective is that you can now define specific business rules / validation logic during the conversion process before sending it to the Data Layer. Here's an old MSDN article, but has some great details explaining a similar approach.