Beispiel #1
0
        /// <param name="stream">The stream content to upload.</param>
        /// <param name="contentType">The content type of the stream content.</param>
        /// <param name="deferSaveChanges">true to delay saving until batch is saved; false to save immediately.</param>
        /// <param name="closeStream">true to close stream after the upload is complete; false to leave stream open.</param>
        public Task UploadMediaAsync(Stream stream, string contentType, bool deferSaveChanges = false, bool closeStream = false)
        {
            var args = new Client.DataServiceRequestArgs
            {
                ContentType = contentType
            };

            Context.SetSaveStream(this, stream, closeStream, args);

            return(SaveChangesAsync(deferSaveChanges));
        }
Beispiel #2
0
        /// <param name="stream">The stream content to upload.</param>
        /// <param name="contentType">The content type of the stream content.</param>
        /// <param name="deferSaveChanges">true to delay saving until batch is saved; false to save immediately.</param>
        /// <param name="closeStream">true to close stream after the upload is complete; false to leave stream open.</param>
        public Task UploadMediaAsync(Stream stream, string contentType, bool deferSaveChanges = false, bool closeStream = false)
        {
            var args = new Client.DataServiceRequestArgs
            {
                ContentType = contentType
            };

            Context.SetSaveStream(this, stream, closeStream, args);

            return SaveChangesAsync(deferSaveChanges);
        }
Beispiel #3
0
        /// <param name="stream">The stream content to upload.</param>
        /// <param name="contentType">The content type of the stream content.</param>
        /// <param name="deferSaveChanges">true to delay saving until batch is saved; false to save immediately.</param>
        /// <param name="closeStream">true to close stream after the upload is complete; false to leave stream open.</param>
        public Task UploadAsync(Stream stream, string contentType, bool deferSaveChanges = false, bool closeStream = false)
        {
            var args = new Client.DataServiceRequestArgs
            {
                ContentType = contentType
            };

            if (_link.ETag != null)
            {
                args.Headers.Add("If-Match", _link.ETag);
            }

            _context.SetSaveStream(_entity, _propertyName, stream, closeStream, args);

            _entity.OnPropertyChanged(_propertyName);

            return _entity.SaveChangesAsync(deferSaveChanges);
        }
Beispiel #4
0
        /// <param name="stream">The stream content to upload.</param>
        /// <param name="contentType">The content type of the stream content.</param>
        /// <param name="deferSaveChanges">true to delay saving until batch is saved; false to save immediately.</param>
        /// <param name="closeStream">true to close stream after the upload is complete; false to leave stream open.</param>
        public Task UploadAsync(Stream stream, string contentType, bool deferSaveChanges = false, bool closeStream = false)
        {
            var args = new Client.DataServiceRequestArgs
            {
                ContentType = contentType
            };

            if (_link.ETag != null)
            {
                args.Headers.Add("If-Match", _link.ETag);
            }

            _context.SetSaveStream(_entity, _propertyName, stream, closeStream, args);

            _entity.OnPropertyChanged(_propertyName);

            return(_entity.SaveChangesAsync(deferSaveChanges));
        }