I am calling a .asmx web service that I have added to a project as a Web Reference.
Any objects that come back from the webservice are in the namespace of the webservice. I would like to use AutoMapper to map these objects to my domain objects.
e.g.:
namespace My.Domain
{
public class Person
{
public string Name { get; set; }
public Pet Pet { get; set; }
}
public class Pet
{
public string Name { get; set; }
}
}
This works...
My.WebService ws = new My.WebService();
My.WebService.Person person = ws.GetPersonById(1);
My.WebService.Pet pet = person.Pet;
But I would like to do this...
using My.Domain;
My.WebService ws = new My.WebService();
Person person = ws.GetPersonById(1);
Pet pet = person.Pet;
Is there somewhere I can put AutoMapper to interject in the webservice so I can do that? Where can I set it up? Or is there some other way I need to do this?