Back to list
Views:   4.4K
Replies:  1
Archived

Mapper.FromDataTransferObject

In Model.cs:
public CustomerModel GetCustomer(int customerId)
{
     //...

return Mapper.FromDataTransferObject(response.Customer);

}
In Mapper.cs
// Maps single customer data transfer object to customer model.
internal static CustomerModel FromDataTransferObject(Customer customer)
{    
    return new CustomerModel    
    {        
      //...
    };
}
My question:

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 1
I 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


Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Licensing       EULA       Sitemap      
© Data & Object Factory, LLC.
Made with    in Austin, Texas