I've a client .net application which execute some call to WebApi server via HttpClient .NET object.
I'm looking for a best and efficient way to send a very large .NET object to my server.
Think of my object as something like following:
public class SampleObj
{
public int ID {get; set;}
public string SomeSimpleProperty {get; set;}
public MemoryStreamOrElseFileStreamOrElseSimilar MyLargeStream {get;set;}
}
Well, in order to avoid out of memory issue, I'd be able to "load" my object in memory by chunck and then send it to server by chunck also.
I've already seen StreamContent class, but my case is a bit more complex since I'm using a .Net type which in turns contains a stream (MyLargeStream property).
How can I manage all of this client and server side?
well, I answer to myself.
I've used a MultipartFormDataStreamProvider in order to contain both filestream and my serialized object.