Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var filename = args[0];
            var service  = new ServiceImpl();
            var response = service.Execute(new Request {
                Payload = filename
            });
            var actualData = BinaryDataContractSerializer.Deserialize <DownloadFileResponse>(response);

            Console.WriteLine($"Congratulation! You have just downloaded {actualData.Data.Length} bytes.");
            Console.WriteLine("How about the total memory consumed?");
            Console.Read();
        }
Ejemplo n.º 2
0
        public Response Execute(Request request)
        {
            // Assuming the request is to read data from a file
            byte[] data         = File.ReadAllBytes(request.Payload);
            var    responseData = new DownloadFileResponse
            {
                Data = data
            };
            var lo = responseData as LargeObject;

            if (lo != null)
            {
                return(new Response {
                    LargeObject = lo
                });
            }
            return(new Response
            {
                QualifiedAssemblyDataType = typeof(DownloadFileResponse).AssemblyQualifiedName,
                SerializedData = BinaryDataContractSerializer.Serialize(responseData)
            });
        }