MyObjects.Sample ConvertSample(MyService.Sample sampleToConvert)
{
MyObjects.Sample x = new MyObjects.Sample();
x.Name = sampleToConvert.Name;
return x;
}
[.net] Good ways to map webserver objects
Hai
I find myself in a problem more often then not that involves some hacky code to fix. I'm just wondering if anyone has come up with a elegent solution to the web service objects conversion.
Example:
I have a assembly MyObjects.dll, I have a webservice MyService.asmx, I have a winforms app consumeing that service MyApp.exe
Both MyApp and MyService use the same MyObjects.dll to get a "Sample" object
But since MyService returns it from a web call I now need to map it to another instance of Sample to use it in my app outside of the DAL area.
I end up writeing dumb code like:
Has anyone come up with a nicer way of doing this?
What happens if you just try to use the object without making a copy? Does it throw an exception later on?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement