i have route returns archived date data stored in protobuf files. currently, use pushstreamcontent
write result in json. here do::
[httpget,route(...)] public async task<httpresponsemessage>( string asset, datetime archivedate, cancellationtoken token ){ var archiveddata = await _archiveservice.getarchiveddata(asset,archivedate,token); if(archiveddata == null){ return await notfound().executeasync(token).configureawait(false); } var response = request.createresponse(httpstatuscode.ok); var res = converttowire(asset,archiveddata); var typeformatter = configuration.formatters.first(); response.content = new pushstreamcontent(async (stream, content, transport) => { using (var outerstream = new bufferedstream(stream, 8*1024)) { await typeformatter.writetostreamasync(res.gettype(), res, outerstream, content, transport, token).configureawait(false); } stream.close(); }, jsonutf8); return response; };
converttowire knows assets support, , applies wire format , returns ienumerable<t>
. can make return iqueryable<t>
(res.toqueryable()
). approach can stream data out of files quite easily. how can add support odata, while still maintaining ability stream result set. of assets have large filesizes (50+ mb) streaming required.