示例#1
0
        public static IEnumerable <T> QueryAllWithOffsetWorkaround <T>(this ISalesforceClient client, string query, int offset)
        {
            Assert.ArgumentNotNull(client, "client");
            Assert.ArgumentNotNullOrEmpty(query, "query");

            var queryResult = client.Query <T>(query);

            if (queryResult.Done)
            {
                return(queryResult.Records.Skip(offset));
            }

            string url = queryResult.NextRecordsUrl.Split('-')[0] + "-" + offset;

            //request URL could be incorrect so catch exception
            try
            {
                queryResult = client.HttpGet <QueryResult <T> >(url);
            }
            catch
            {
                return(Enumerable.Empty <T>());
            }

            return(client.GetAll(queryResult));
        }
示例#2
0
        public static IEnumerable <T> QueryAll <T>(this ISalesforceClient client, string query)
        {
            Assert.ArgumentNotNull(client, "client");
            Assert.ArgumentNotNullOrEmpty(query, "query");

            var queryResult = client.Query <T>(query);

            return(client.GetAll(queryResult));
        }