I have a call to a SOAP WCF Service that returns a lot of data. More than the calling Windows Mobile Device can handle.
Yet I am noticing something odd. When I make the call it looks like this:
MyContract[] myContractArray = MyService.CallToGetLotsOfDataObjects();
That does not fail. But when it iterate through myContractArray
and put them into client side classes, then it fails.
At first I just said, "well, it can't handle having two copies of the data, that is just too much". But now I am wondering if myContractArray
is actually holding the data after the above call. I am wondering if it is kind of like a Linq-To-SQL call where it does not get loaded till it is needed.
So here is my question, at what point below does the data get allocated on the client?
// Create the service
var serviceLib = new MyServiceDataServiceLib();
// 1 -----------------+
// |
// V
MyContract[] myContractArray = serviceLib.WCFCallToGetLotsOfDataObjects();
List<MyClass> myClassList = new List<MyClass>()
// 3 -----------------+ +------------------ 2
// | |
// V v
foreach(MyContract myContractInstance in myContractArray )
{
MyClass myClassInstance = new MyClass();
myClassInstance.BigImage = myContractInstance.BigImage;
myClassInstance.MoreData = myContractInstance.MoreData;
myClassInstance.EvenMoreData = myContractInstance.EvenMoreData;
myClassList.Add(myClassInstance);
}
Is it at:
- When the call is made to the server
- When I begin to iterate the list (less likely in my opinion)
- As I need each instance
I think it 1 or 3, but I am not sure which it is. Does anyone know?
(NOTE: I am using Visual Studio 2008 and .net 3.5. My client side is a Windows Mobile application)