Esempio n. 1
0
 /// <summary>
 /// Closes the save stream if there's any and sets it to null
 /// </summary>
 internal void CloseSaveStream()
 {
     if (this.SaveStream != null)
     {
         DataServiceSaveStream stream = this.SaveStream;
         this.SaveStream = null;
         stream.Close();
     }
 }
Esempio n. 2
0
        private void SetupMediaResourceRequest(ODataRequestMessageWrapper mediaResourceRequest, DataServiceSaveStream saveStream, string etag)
        {
            IEnumerable <string> keys;

            base.mediaResourceRequestStream = saveStream.Stream;
            WebUtil.ApplyHeadersToRequest(saveStream.Args.Headers, mediaResourceRequest, true);
            Dictionary <string, string> headers = saveStream.Args.Headers;

            if (headers.ContainsKey("Accept"))
            {
                keys = new List <string>(headers.Count - 1);
                foreach (string str in headers.Keys)
                {
                    if (str != "Accept")
                    {
                        ((List <string>)keys).Add(str);
                    }
                }
            }
            else
            {
                keys = headers.Keys;
            }
            mediaResourceRequest.AddHeadersToReset(keys);
            if (etag != null)
            {
                mediaResourceRequest.SetHeader("If-Match", etag);
                mediaResourceRequest.AddHeadersToReset("If-Match");
            }
        }
Esempio n. 3
0
 /// <summary>
 /// constructor
 /// </summary>
 /// <param name="saveStream">Stream to save</param>
 /// <param name="streamState">State of stream</param>
 /// <param name="streamETag">Etag of stream</param>
 public SerializableStreamState(DataServiceSaveStream saveStream, EntityStates streamState, string streamETag)
 {
     this.StreamETag  = streamETag;
     this.SaveStream  = saveStream;
     this.StreamState = streamState;
 }