Ejemplo n.º 1
0
        public override Object Execute()
        {
            if (Ids == null)
            {
                throw new InvalidOperationException("Ids cannot be null.");
            }

            List <User> batch = new List <User>();

            // Query in a loop to respect AngelListClient.QueryParameterLimit.

            for (int queryStartIndex = 0; queryStartIndex <= Ids.Count; queryStartIndex += AngelListClient.QueryParameterLimit)
            {
                int queryCount = (Ids.Count - queryStartIndex > AngelListClient.QueryParameterLimit) ? AngelListClient.QueryParameterLimit : Ids.Count - queryStartIndex;

                var ids = Ids.GetRange(queryStartIndex, queryCount);

                try
                {
                    batch.AddRange(AngelListClient.UsersBatch(ids));
                }
                catch (AngelListClientException ex)
                {
                    var entry = new LogEntry();
                    entry.Categories = new string[] { "General", "Warning" };
                    entry.Message    = string.Format("An exception occurred when calling the service. No further ids will be processed. Id list: {0}. Exception: {1}", String.Join(",", ids), ex);
                    entry.Severity   = TraceEventType.Error;
                    defaultLogWriter.Write(entry);
                }
            }

            return(batch);
        }
Ejemplo n.º 2
0
        public override Object Execute()
        {
            List <User> results = AngelListClient.UsersBatch(Ids);

            return(ProcessUsersBatchResult(results));
        }