/// <summary> /// Get specified count of entities from first feed of service document. /// </summary> /// <param name="context">The service document context.</param> /// <returns>Returns an entity URLs's list.</returns> public static bool GetBatchSupportedEntityUrls(out KeyValuePair <string, IEnumerable <string> > entityUrls) { entityUrls = new KeyValuePair <string, IEnumerable <string> >(); var svcStatus = ServiceStatus.GetInstance(); List <string> vocDocs = new List <string>() { TermDocuments.GetInstance().VocCapabilitiesDoc }; var payloadFormat = svcStatus.ServiceDocument.GetFormatFromPayload(); var batchSupportedEntitySetUrls = new List <string>(); var batchSupportedEntitySetNames = AnnotationsHelper.SelectEntitySetSupportBatch(svcStatus.MetadataDocument, vocDocs); batchSupportedEntitySetNames.ForEach(temp => { batchSupportedEntitySetUrls.Add(temp.MapEntitySetNameToEntitySetURL()); }); var entitySetUrls = ContextHelper.GetFeeds(svcStatus.ServiceDocument, payloadFormat).ToArray(); if (entitySetUrls.Any()) { string entitySetUrl = string.Empty; foreach (var setUrl in entitySetUrls) { try { string entityTypeShortName = setUrl.MapEntitySetURLToEntityTypeShortName(); if (batchSupportedEntitySetUrls.Contains(setUrl) && !entityTypeShortName.IsMediaType()) { entitySetUrl = setUrl; break; } } catch (Exception ex) { throw ex; string test = ex.Message; } } if (string.IsNullOrEmpty(entitySetUrl)) { return(false); } string url = string.Format("{0}/{1}?$top=1", svcStatus.RootURL.TrimEnd('/'), entitySetUrl); Response response = WebHelper.Get(new Uri(url), Constants.V4AcceptHeaderJsonFullMetadata, RuleEngineSetting.Instance().DefaultMaximumPayloadSize, svcStatus.DefaultHeaders); payloadFormat = response.ResponsePayload.GetFormatFromPayload(); var payloadType = ContextHelper.GetPayloadType(response.ResponsePayload, payloadFormat, response.ResponseHeaders); if (payloadType == RuleEngine.PayloadType.Feed) { entityUrls = new KeyValuePair <string, IEnumerable <string> >(entitySetUrl, ContextHelper.GetEntries(response.ResponsePayload, payloadFormat)); return(true); } } return(false); }