예제 #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));
        }
예제 #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);
        }
예제 #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);
        }
예제 #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));
        }