private void InternalLoadCollection(IEnumerable <T> items)
        {
            Debug.Assert(items != null, "items != null");
#if !ASTORIA_LIGHT
            DataServiceQuery <T> query = items as DataServiceQuery <T>;
            if (query != null)
            {
                items = query.Execute() as QueryOperationResponse <T>;
            }
#else
            Debug.Assert(!(items is DataServiceQuery), "SL Client using DSQ as items...should have been caught by ValidateIteratorParameter.");
#endif

            foreach (T item in items)
            {
                if (!this.Contains(item))
                {
                    this.Add(item);
                }
            }

            QueryOperationResponse <T> response = items as QueryOperationResponse <T>;
            if (response != null)
            {
                this.continuation = response.GetContinuation();
            }
            else
            {
                this.continuation = null;
            }
        }
Exemple #2
0
        private void InternalLoadCollection(IEnumerable <T> items)
        {
            DataServiceQuery <T> query = items as DataServiceQuery <T>;

            if (query != null)
            {
                items = query.Execute() as QueryOperationResponse <T>;
            }
            foreach (T local in items)
            {
                if (!base.Contains(local))
                {
                    base.Add(local);
                }
            }
            QueryOperationResponse <T> response = items as QueryOperationResponse <T>;

            if (response != null)
            {
                this.continuation = response.GetContinuation();
            }
            else
            {
                this.continuation = null;
            }
        }
        /// <summary>
        /// Populate this collection with another collection of items
        /// </summary>
        /// <param name="items">The items to populate this collection with</param>
        private void InternalLoadCollection(IEnumerable <T> items)
        {
            Debug.Assert(items != null, "items != null");
#if !ASTORIA_LIGHT
            // For SDP, we must execute the Query implicitly
            DataServiceQuery <T> query = items as DataServiceQuery <T>;
            if (query != null)
            {
                items = query.Execute() as QueryOperationResponse <T>;
            }
#else
            Debug.Assert(!(items is DataServiceQuery), "SL Client using DSQ as items...should have been caught by ValidateIteratorParameter.");
#endif

            foreach (T item in items)
            {
                // if this is too slow, consider hashing the set
                // or just use LoadProperties
                if (!this.Contains(item))
                {
                    this.Add(item);
                }
            }

            QueryOperationResponse <T> response = items as QueryOperationResponse <T>;
            if (response != null)
            {
                // this should never be throwing (since we've enumerated already)!
                // Note: Inner collection's nextPartLinkUri is set by the materializer
                this.continuation = response.GetContinuation();
            }
            else
            {
                this.continuation = null;
            }
        }