示例#1
0
 public UploadMultipartStreamProvider(
     IUploadWriterProvider writerProvider,
     UploadStatusManager status,
     Type modelType)
 {
     _writerProvider = writerProvider;
     _status         = status;
     _modelType      = modelType;
 }
示例#2
0
        public override async Task <object> ReadFromStreamAsync(
            Type type, Stream readStream, HttpContent content,
            IFormatterLogger formatterLogger)
        {
            var statusManager = new UploadStatusManager(
                GetProgressHeaderValue(content.Headers),
                content.Headers.ContentLength.GetValueOrDefault());

            var filePartStreamProvider = _getFilePartStreamProvider(type, content);

            var streamProvider = new UploadMultipartStreamProvider(
                filePartStreamProvider,
                statusManager,
                type);

            var contents = await content.ReadAsMultipartAsync(
                streamProvider);

            return(contents.GetModel(type));
        }