Example #1
0
        public IEnumerable <TResult> ExecuteSoqlQuery <TModel, TResult>(string query, Func <TModel, TResult> projector) where TModel : class, new()
        {
            //TODO add Enumerator
            QueryResult qr  = _binding.queryAll(query);
            var         res = qr.records.Select(Map <TModel>);

            return(Enumerable.Select(res, projector));
        }
        /// <summary>
        /// Gets Salesforce objects.
        /// </summary>
        /// <param name="queryString">Query string.</param>
        /// <returns>List of Salesforce objects.</returns>
        public List <sObject> GetObjects(string queryString)
        {
            var result = new List <sObject>();

            if (CheckConnected())
            {
                QueryResult qr = _binding.queryAll(queryString);

                while (qr.size > 0)
                {
                    result.AddRange(qr.records.ToList()); qr.size = 0;

                    if (!qr.done)
                    {
                        qr = _binding.queryMore(qr.queryLocator);
                    }
                }
            }

            return(result);
        }