/// <summary>
        /// Gets specific collection of entities and return a skipToken if there are more than
        /// 60 entities to be returned.
        /// </summary>
        /// <param name="query">oData query</param>
        /// <param name="skipToken">The skip token to be used to get the next page of data.</param>
        /// <returns>List of entity Objects</returns>
        public async Task <Tuple <string, List <T> > > GetAsync(string query, string skipToken)
        {
            // Get the response and convert it to a list of entities of the specific type
            string response = await _conn.GetAsync(query);

            skipToken = ApiResponseCleaner.GetSkipToken(response);
            response  = ApiResponseCleaner.GetJsonArray(response);

            var rc       = new EntityConverter();
            var entities = await rc.ConvertJsonArrayToObjectListAsync <T>(response);

            // If the entity isn't managed already, register to managed entity collection
            foreach (var entity in entities)
            {
                AddEntityToManagedEntitiesCollection(entity);
            }

            // Convert list
            return(new Tuple <string, List <T> >(skipToken, entities));
        }
示例#2
0
        /// <summary>
        /// Gets specific collection of entities and return a skipToken if there are more than
        /// 60 entities to be returned.
        /// </summary>
        /// <param name="query">oData query</param>
        /// <returns>List of entity Objects</returns>
        public async Task <Models.ApiList <T> > GetAsync(string query)
        {
            // Get the response and convert it to a list of entities of the specific type
            string response = await _conn.GetAsync(query).ConfigureAwait(false);

            string skipToken = ApiResponseCleaner.GetSkipToken(response);

            response = ApiResponseCleaner.GetJsonArray(response);

            var rc       = new EntityConverter();
            var entities = rc.ConvertJsonArrayToObjectList <T>(response);

            // If the entity isn't managed already, register to managed entity collection
            foreach (var entity in entities)
            {
                AddEntityToManagedEntitiesCollection(entity);
            }

            // Convert list
            return(new Models.ApiList <T>(entities.ConvertAll(x => x), skipToken));
        }