views:

82

answers:

1

Hello guys. I've got common scenario: SL app and wcf service as data source. I use dtos for transport business objects over the wire. I get issue - Update entity. At client form I have binded dto and send to wcf. I want to know nice way update real db entity by dto data. At wcf I use Nhibernate DAL. My way is getting attached entity by id from db and copy all props(with nested objects) from dto. But I think it's not flexible and good. Can u advice me better way. Thanks.

A: 

Like anything DTOs have pros & cons but when your DTOs are exactly the same as your Entities it can seem like a burden to do the property mapping manually.

Try looking at AutoMapper which should help you speed up the property mapping.

willbt
Thanks. I use AutoMapper to map my db objects to DTOs. But I wonder can I use vice versa variant, cause I need proxy of nested objects instaed of int id and other... My dtos aren't the same as entities
Andrew Kalashnikov