Views: 4.4K
Replies: 1
Archived
|
Mapper.FromDataTransferObjectIn Model.cs:
public CustomerModel GetCustomer(int customerId) { //... // Maps single customer data transfer object to customer model. internal static CustomerModel FromDataTransferObject(Customer customer) { return new CustomerModel { //... }; } What FromDataTransferObject(Customer customer) used for? Convert from customerDTO to customerMODEL Or Convert from customerBO to customerMODEL. I see customerDTO passing to FromDataTransferObject function from GetCustomer, but why parameter input of FromDataTransferObject function is customerBO, NOT customerDTO? Thanks. EDH4 ☺, Jul 01, 2014
|
|
Reply 1I found the answer. FromDataTransferObject(Customer customer) will convert customerDTO to customerMODEL.
Solution: 1. Look at CustomerDto.cs Change [DataContract(Name = "Customer", Namespace = "http://www.yourcompany.com/types/")] public class CustomerDto { } to [DataContract(Name = "CustomerDto", Namespace = "http://www.yourcompany.com/types/")] public class CustomerDto { } 2. Look at Mapper.cs Change internal static CustomerModel FromDataTransferObject(Customer customer) to internal static CustomerModel FromDataTransferObject(CustomerDto customer) Thanks. EDH4 ☺, Jul 01, 2014
|