public override object ReadFromStream(Stream stream, HttpRequestMessage request) { try { var serializer = new JsonSerializer(); using (StreamReader sr = new StreamReader(stream)) { using (JsonTextReader reader = new JsonTextReader(sr)) { object result = serializer.Deserialize(reader, parameterType); return(result); } } } catch (Exception ex) { ErrorMessageInterceptor.ThrowError(HttpStatusCode.Forbidden, ex); throw; } }
public void ProcessStream() { try { //reset the counter just in case... _counter = 0; //intitalize the return stream textWriter = new StreamWriter(this.stream); //witer the titles of the tab delimited file foreach (KeyValuePair <int, ColumnDescriptionAndValues> colDesc in fileDescription.Settings.OrderBy(s => s.Key)) { textWriter.Write("{0}\t", colDesc.Value.ColumnName); } textWriter.WriteLine(); //Create the file duplicate the fields create Cartesian product CartesianProduct(0); //pay attention yaron should sent the first col as 0 or you will need to change the method } catch (Exception ex) { ErrorMessageInterceptor.ThrowError(System.Net.HttpStatusCode.Forbidden, ex); } }