Pattern/Strategy for creating BOs from DTOs
问题 I like the approach of having property bag objects (DTOs) which define the interface to my server, but I don't like writing code like this: void ModifyDataSomeWay(WibbleDTO wibbleDTO) { WibbleBOWithMethods wibbleBO = new WibbleBOWithMethods(); wibbleBO.Val1 = wibbleDTO.Val1; wibbleBO.Val2 = wibbleDTO.Val2; } This copying code is quite laborious to write. If the copying code is unavoidable, then where do you put it? In the BO? In a factory? If it is possible to manually avoid writing the