private static void runTest(string culture) { CultureInfo.DefaultThreadCurrentCulture = new CultureInfo(culture); CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo(culture); Console.Write("CurrentCulture is {0}. Result: ", CultureInfo.CurrentCulture.Name); Criteria allCriteria = CriteriaFactory.And(new ItemTypeCriteria(64), new PageURLCriteria(ConfigurationManager.AppSettings["pageUrl"])); allCriteria.AddCriteria(new PublicationCriteria(int.Parse(ConfigurationManager.AppSettings["publicationId"]))); Query pageQuery = new Query(); pageQuery.Criteria = allCriteria; string[] resultUris = pageQuery.ExecuteQuery(); if (resultUris.Length > 0) { foreach (string uri in resultUris) { Console.WriteLine("{0}\n", uri); } } else { Console.WriteLine("NO RESULTS\n"); } }
/// <summary> /// Gets the raw string (xml) from the broker db by URL /// </summary> /// <param name="Url">URL of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> public string GetContentByUrl(string Url) { string retVal = string.Empty; Query pageQuery = new Query(); ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere PageURLCriteria pageUrl = new PageURLCriteria(Url); Criteria allCriteria = CriteriaFactory.And(isPage, pageUrl); if (this.PublicationId != 0) { PublicationCriteria correctSite = new PublicationCriteria(this.PublicationId); allCriteria.AddCriteria(correctSite); } pageQuery.Criteria = allCriteria; string[] resultUris = pageQuery.ExecuteQuery(); if (resultUris.Length > 0) { PageContentAssembler loadPage = new PageContentAssembler(); retVal = loadPage.GetContent(resultUris[0]); } return(retVal); }
/// <summary> /// Gets the raw string (xml) from the broker db by URL /// </summary> /// <param name="Url">URL of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> public string GetContentByUrl(string Url) { LoggerService.Debug(">>GetContentByUrl({0})", LoggingCategory.Performance, Url); string retVal = string.Empty; LoggerService.Debug("GetContentByUrl: about to create query", LoggingCategory.Performance); Query pageQuery = new Query(); LoggerService.Debug("GetContentByUrl: created query", LoggingCategory.Performance); ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere PageURLCriteria pageUrl = new PageURLCriteria(Url); Criteria allCriteria = CriteriaFactory.And(isPage, pageUrl); if (this.PublicationId != 0) { PublicationCriteria correctSite = new PublicationCriteria(this.PublicationId); allCriteria.AddCriteria(correctSite); } pageQuery.Criteria = allCriteria; LoggerService.Debug("GetContentByUrl: added criteria to query", LoggingCategory.Performance); LoggerService.Debug("GetContentByUrl: about to execute query", LoggingCategory.Performance); string[] resultUris = pageQuery.ExecuteQuery(); LoggerService.Debug("GetContentByUrl: executed query", LoggingCategory.Performance); if (resultUris.Length > 0) { retVal = PageContentAssembler.GetContent(resultUris[0]); LoggerService.Debug("GetContentByUrl: executed PageContentAssembler", LoggingCategory.Performance); } LoggerService.Debug("<<GetContentByUrl({0})", LoggingCategory.Performance, Url); return(retVal); }
string IRawDataProvider.GetPageContent(string urlPath, Localization localization) { // TODO: let the DXA Model Service provide raw Page Content too (?) using (new Tracer(urlPath, localization)) { if (!urlPath.EndsWith(Constants.DefaultExtension) && !urlPath.EndsWith(".json")) { urlPath += Constants.DefaultExtension; } string escapedUrlPath = Uri.EscapeUriString(urlPath); global::Tridion.ContentDelivery.DynamicContent.Query.Query brokerQuery = new global::Tridion.ContentDelivery.DynamicContent.Query.Query { Criteria = CriteriaFactory.And(new Criteria[] { new PageURLCriteria(escapedUrlPath), new PublicationCriteria(Convert.ToInt32(localization.Id)), new ItemTypeCriteria(64) }) }; string[] pageUris = brokerQuery.ExecuteQuery(); if (pageUris.Length == 0) { return(null); } if (pageUris.Length > 1) { throw new DxaException($"Broker Query for Page URL path '{urlPath}' in Publication '{localization.Id}' returned {pageUris.Length} results."); } PageContentAssembler pageContentAssembler = new PageContentAssembler(); return(pageContentAssembler.GetContent(pageUris[0])); } }
/// <summary> /// Gets the raw string (xml) from the broker db by URL /// </summary> /// <param name="Url">URL of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> private string GetStringContentFromBrokerByUrl(string Url) { string retVal = string.Empty; Query pageQuery = new Query(); ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere PageURLCriteria pageUrl = new PageURLCriteria(Url); PublicationCriteria correctSite = new PublicationCriteria(PublicationId); //Todo: add logic to determine site on url Criteria allCriteria = CriteriaFactory.And(isPage, pageUrl); allCriteria.AddCriteria(correctSite); pageQuery.Criteria = allCriteria; string[] resultUris = pageQuery.ExecuteQuery(); if (resultUris.Length > 0) { PageContentAssembler loadPage = new PageContentAssembler(); retVal = loadPage.GetContent(resultUris[0]); } return(retVal); }
public DateTime LastPublished(string[] schemaUris) { TcmUri schemaTcmUri = new TcmUri(schemaUris.First()); PublicationCriteria publicationCriteria = new PublicationCriteria(schemaTcmUri.PublicationId); Criteria[] schemaCriterias = schemaUris .Select(uri => new ItemSchemaCriteria(new TcmUri(uri).ItemId)) .ToArray(); Criteria basedOnSchema = CriteriaFactory.Or(schemaCriterias); Criteria basedOnSchemaAndInPublication = CriteriaFactory.And(publicationCriteria, basedOnSchema); Query q = new Query(basedOnSchemaAndInPublication); SortParameter sortParameter = new SortParameter(SortParameter.ItemLastPublishedDate, SortParameter.Descending); q.AddSorting(sortParameter); q.AddLimitFilter(new LimitFilter(1)); string[] foundUris = q.ExecuteQuery(); if (foundUris.Length > 0) { using (Tridion.ContentDelivery.Meta.ComponentMetaFactory fac = new Tridion.ContentDelivery.Meta.ComponentMetaFactory(schemaTcmUri.PublicationId)) { Tridion.ContentDelivery.Meta.IComponentMeta meta = fac.GetMeta(foundUris[0]); return(meta.LastPublicationDate); } } return(DateTime.MinValue); }
/// <summary> /// Get all urls of published pages /// </summary> /// <param name="includeExtensions"></param> /// <param name="pathStarts"></param> /// <param name="publicationID"></param> /// <returns></returns> public string[] GetAllPublishedPageUrls(string[] includeExtensions, string[] pathStarts) { Query pageQuery = new Query(); ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere PublicationCriteria currentPublication = new PublicationCriteria(PublicationId); //Todo: add logic to determine site on url Criteria pageInPublication = CriteriaFactory.And(isPage, currentPublication); if (includeExtensions.Length > 0) { PageURLCriteria[] extensionsCriteria = new PageURLCriteria[includeExtensions.Length]; int criteriaCount = 0; foreach (string pageExtension in includeExtensions) { extensionsCriteria.SetValue(new PageURLCriteria("%" + pageExtension, Criteria.Like), criteriaCount); criteriaCount++; } Criteria allExtensions = CriteriaFactory.Or(extensionsCriteria); pageInPublication = CriteriaFactory.And(pageInPublication, allExtensions); } if (pathStarts.Length > 0) { PageURLCriteria[] pathCriteria = new PageURLCriteria[pathStarts.Length]; int criteriaCount = 0; foreach (string requiredPath in pathStarts) { pathCriteria.SetValue(new PageURLCriteria(requiredPath + "%", Criteria.Like), criteriaCount); criteriaCount++; } Criteria allPaths = CriteriaFactory.Or(pathCriteria); pageInPublication = CriteriaFactory.And(pageInPublication, allPaths); } Query findPages = new Query(pageInPublication); string[] pageUris = findPages.ExecuteQuery(); // Need to get PageMeta data to find all the urls List <string> pageUrls = new List <string>(); foreach (string uri in pageUris) { TcmUri tcmUri = new TcmUri(uri); PageMetaFactory metaFactory = GetPageMetaFactory(tcmUri.PublicationId); IPageMeta currentMeta = metaFactory.GetMeta(uri); pageUrls.Add(currentMeta.UrlPath); } return(pageUrls.ToArray()); }
private static List <XmlDocument> BuildAndExecute(int contentRepositoryId, Criteria[] criteria, int nbrOfRecords) { Query query; List <XmlDocument> results; PublicationCriteria publicationCriteria = new PublicationCriteria(contentRepositoryId); Criteria searchCriteria = CriteriaFactory.And(criteria); searchCriteria = CriteriaFactory.And(searchCriteria, publicationCriteria); query = new Query { Criteria = searchCriteria }; SortParameter sortParameter = new SortParameter(SortParameter.ItemTitle, SortParameter.Ascending); LimitFilter limitFilter = new LimitFilter(nbrOfRecords); results = ExecuteQuery(query, limitFilter, sortParameter); return(results); }
public bool TryFindBinary(string url, out IBinary binary) { string encodedUrl = HttpUtility.UrlPathEncode(url); binary = null; //using (var sqlBinMetaHome = new Com.Tridion.Broker.Binaries.Meta.SQLBinaryMetaHome()) //{ // Com.Tridion.Meta.BinaryMeta binaryMeta = sqlBinMetaHome.FindByURL(PublicationId, encodedUrl); // "/Images/anubis_pecunia160_tcm70-520973.jpg" // if (binaryMeta != null) // { // using (var sqlBinaryHome = new Com.Tridion.Broker.Binaries.SQLBinaryHome()) // { // Com.Tridion.Data.BinaryData binData = sqlBinaryHome.FindByPrimaryKey(PublicationId, (int)binaryMeta.GetId()); // if (binData != null) // { // binary = new Binary(this) // { // Id = String.Format("tcm:{0}-{1}", binData.GetPublicationId(), binData.GetId()), // Url = url, // LastPublishedDate = DateTime.Now, // Multimedia = null, // VariantId = binData.GetVariantId() // }; // return true; // } // } // } // return false; //} Query binaryQuery = new Query(); ItemTypeCriteria isMultiMedia = new ItemTypeCriteria(32); PublicationCriteria inPub = new PublicationCriteria(PublicationId); Criteria allCriteria = CriteriaFactory.And(isMultiMedia, inPub); string[] results = binaryQuery.ExecuteQuery(); binary = null; return(true); foreach (var item in results) { } }
/// <summary> /// Gets the raw string (xml) from the broker db by URL /// </summary> /// <param name="Url">URL of the page</param> /// <returns>String with page xml or empty string if no page was found</returns> public string GetContentByUrl(string Url) { LoggerService.Debug(">>GetContentByUrl({0})", LoggingCategory.Performance, Url); string retVal = string.Empty; LoggerService.Debug("GetContentByUrl: about to create query", LoggingCategory.Performance); using (var pageQuery = new Query()) { LoggerService.Debug("GetContentByUrl: created query", LoggingCategory.Performance); using (var isPage = new ItemTypeCriteria(64)) { using (var pageUrl = new PageURLCriteria(Url)) { using (var allCriteria = CriteriaFactory.And(isPage, pageUrl)) { if (this.PublicationId != 0) { using (var correctSite = new PublicationCriteria(this.PublicationId)) { allCriteria.AddCriteria(correctSite); } } pageQuery.Criteria = allCriteria; } } } LoggerService.Debug("GetContentByUrl: added criteria to query", LoggingCategory.Performance); LoggerService.Debug("GetContentByUrl: about to execute query", LoggingCategory.Performance); string[] resultUris = pageQuery.ExecuteQuery(); pageQuery.Dispose(); LoggerService.Debug("GetContentByUrl: executed query", LoggingCategory.Performance); if (resultUris.Length > 0) { retVal = PageContentAssembler.GetContent(resultUris[0]); LoggerService.Debug("GetContentByUrl: executed PageContentAssembler", LoggingCategory.Performance); } LoggerService.Debug("<<GetContentByUrl({0})", LoggingCategory.Performance, Url); return(retVal); } }
public static IPageMeta GetPageMetaFromSEO(HttpRequestBase request, string url) { PageMetaFactory pageMetaFactory = new PageMetaFactory(SiteGlobal.PublicationId); IPageMeta pageMeta = pageMetaFactory.GetMetaByUrl(SiteGlobal.PublicationId, url); if (pageMeta == null) { // Check if it is a Vanity URL var publicationCriteria = new PublicationCriteria(SiteGlobal.PublicationId); var pageCriteria = new ItemTypeCriteria((int)TridionItemType.Page); var vanityUrlCriteria = new CustomMetaValueCriteria(new CustomMetaKeyCriteria("SEOUrl", Criteria.Equal), url); // -- Query query = new Query(); query.Criteria = CriteriaFactory.And(new Criteria[] { publicationCriteria, pageCriteria, vanityUrlCriteria }); IEnumerable <string> pages = query.ExecuteQuery(); //If no result, we try taking the ApplicationPath ['/en'] fro the url if (!pages.Any() && url.ToLower().StartsWith(request.ApplicationPath.ToLower())) { var urlWithoutAppPath = url.Substring(request.ApplicationPath.Length); var vanityUrlCriteria2 = new CustomMetaValueCriteria(new CustomMetaKeyCriteria("SEOUrl", Criteria.Equal), urlWithoutAppPath); query.Criteria = CriteriaFactory.And(new Criteria[] { publicationCriteria, pageCriteria, vanityUrlCriteria2 }); pages = query.ExecuteQuery(); //If no result, we try taking the '/' from the begining of the url. if (!pages.Any()) { urlWithoutAppPath = urlWithoutAppPath.TrimStart('/'); vanityUrlCriteria2 = new CustomMetaValueCriteria(new CustomMetaKeyCriteria("SEOUrl", Criteria.Equal), urlWithoutAppPath); query.Criteria = CriteriaFactory.And(new Criteria[] { publicationCriteria, pageCriteria, vanityUrlCriteria2 }); pages = query.ExecuteQuery(); } } if (pages.Any()) { pageMeta = pageMetaFactory.GetMeta(pages.First()); } } return(pageMeta); }
/// <summary> /// this method shall be used to return the component based on a categories and keywords /// </summary> /// <param name="category"></param> /// <param name="keywords"></param> /// <param name="contentRepositoryId"></param> /// <returns></returns> public static List <XmlDocument> GetComponentsByKeywords(string[] category, string[] keywords, int contentRepositoryId, int nbrOfRecords) { List <XmlDocument> results; Criteria criteria = null; KeywordCriteria keywordCriteria; ItemTypeCriteria typeCriteria = new ItemTypeCriteria(TRIDION_ITEMTYPE); for (int i = 0; i < keywords.Length; i++) { keywordCriteria = new KeywordCriteria(category[i], keywords[i]); if (i == 0) { criteria = CriteriaFactory.And(keywordCriteria, typeCriteria); } else { criteria = CriteriaFactory.And(keywordCriteria, criteria); } } results = BuildAndExecute(contentRepositoryId, new Criteria[] { criteria }, nbrOfRecords); return(results); }
private string[] FindComponentUrisBySchemas(string[] schemaUris, int?limit, DateTime?sinceLastPublished) { TcmUri schemaTcmUri = new TcmUri(schemaUris.First()); PublicationCriteria publicationCriteria = new PublicationCriteria(schemaTcmUri.PublicationId); Criteria[] schemaCriterias = schemaUris .Select(uri => new ItemSchemaCriteria(new TcmUri(uri).ItemId)) .ToArray(); Criteria basedOnSchema = CriteriaFactory.Or(schemaCriterias); Criteria basedOnSchemaAndInPublication = CriteriaFactory.And(publicationCriteria, basedOnSchema); if (sinceLastPublished.HasValue) { ItemLastPublishedDateCriteria dateLastPublished = new ItemLastPublishedDateCriteria(sinceLastPublished.Value.ToString("yyyy-MM-dd hh:mm:ss"), Criteria.GreaterThanOrEqual); basedOnSchemaAndInPublication = CriteriaFactory.And(basedOnSchemaAndInPublication, dateLastPublished); } Query q = new Query(basedOnSchemaAndInPublication); SortParameter sortParameter = new SortParameter(SortParameter.ItemLastPublishedDate, SortParameter.Descending); q.AddSorting(sortParameter); if (limit.HasValue && limit.Value > 0) { q.AddLimitFilter(new LimitFilter(limit.Value)); } else { q.AddLimitFilter(new LimitFilter(maximumComponent)); } return(q.ExecuteQuery()); }
public Tridion.ContentDelivery.DynamicContent.Query.Query ToTridionQuery() { string[] basedOnSchemas = QuerySchemas; DateTime lastPublishedDate = LastPublishedDate; IList <MetaQueryItem> metaQueryItems = MetaQueryValues; QueryLogic metaQueryLogic = MetaQueryLogic; int maxmimumComponents = MaximumComponents; Query q = null; //PublicationCriteria publicationAndLastPublishedDateCriteria = new PublicationCriteria(PublicationId); PublicationCriteria publicationAndLastPublishedDateCriteria = new PublicationCriteria(PublicationId); //format DateTime // 00:00:00.000 ItemLastPublishedDateCriteria dateLastPublished = new ItemLastPublishedDateCriteria(lastPublishedDate.ToString("yyyy-MM-dd HH:mm:ss.fff"), Criteria.GreaterThanOrEqual); //publicationAndLastPublishedDateCriteria.AddCriteria(dateLastPublished); Criteria basedOnSchemaAndInPublication; if (basedOnSchemas.Length > 0) { Criteria[] schemaCriterias = new Criteria[basedOnSchemas.Length]; int i = 0; foreach (var schema in basedOnSchemas) { TcmUri schemaUri = new TcmUri(schema); schemaCriterias.SetValue(new ItemSchemaCriteria(schemaUri.ItemId), i); i++; } Criteria basedOnSchema = CriteriaFactory.Or(schemaCriterias); basedOnSchemaAndInPublication = CriteriaFactory.And(publicationAndLastPublishedDateCriteria, basedOnSchema); } else { basedOnSchemaAndInPublication = publicationAndLastPublishedDateCriteria; } // Add filtering for meta data Criteria schemasAndMetaData; if (metaQueryItems.Count > 0) { Criteria metaQuery; Criteria[] metaCriterias = new Criteria[metaQueryItems.Count]; int metaCount = 0; foreach (MetaQueryItem queryItem in metaQueryItems) { CustomMetaKeyCriteria metaField = new CustomMetaKeyCriteria(queryItem.MetaField); CustomMetaValueCriteria metaCriteria; FieldOperator metaOperator = typeof(Criteria).GetField(queryItem.MetaOperator.ToString()).GetValue(null) as FieldOperator; switch (queryItem.MetaValue.GetType().Name) { case "DateTime": DateTime tempDate = (DateTime)queryItem.MetaValue; metaCriteria = new CustomMetaValueCriteria(metaField, tempDate.ToString("yyyy-MM-dd HH:mm:ss.fff"), "yyyy-MM-dd HH:mm:ss.SSS", metaOperator); break; case "Float": metaCriteria = new CustomMetaValueCriteria(metaField, (float)queryItem.MetaValue, metaOperator); break; case "String": metaCriteria = new CustomMetaValueCriteria(metaField, queryItem.MetaValue as string, metaOperator); break; default: throw new System.Exception("Unexpected query item data type; " + queryItem.MetaValue.GetType().Name); } metaCriterias.SetValue(metaCriteria, metaCount); metaCount++; } if (MetaQueryLogic == QueryLogic.AllCriteriaMatch) { metaQuery = CriteriaFactory.And(metaCriterias); } else { metaQuery = CriteriaFactory.Or(metaCriterias); } schemasAndMetaData = CriteriaFactory.And(basedOnSchemaAndInPublication, metaQuery); } else { schemasAndMetaData = basedOnSchemaAndInPublication; } Criteria allConditions; if (KeywordValues.Count > 0) { Criteria[] keywordCriterias = new Criteria[KeywordValues.Count]; int keywordCount = 0; foreach (KeywordItem keyCriteria in KeywordValues) { TaxonomyKeywordCriteria keywordField = new TaxonomyKeywordCriteria(keyCriteria.CategoryUri, keyCriteria.KeywordUri, false); keywordCriterias.SetValue(keywordField, keywordCount); keywordCount++; } Criteria keyQuery; if (KeywordQueryLogic == QueryLogic.AllCriteriaMatch) { keyQuery = CriteriaFactory.And(keywordCriterias); } else { keyQuery = CriteriaFactory.Or(keywordCriterias); } allConditions = CriteriaFactory.And(schemasAndMetaData, keyQuery); } else { allConditions = schemasAndMetaData; } q = new Query(allConditions); if (maxmimumComponents != 0 && maxmimumComponents != int.MaxValue) { LimitFilter limitResults = new LimitFilter(maxmimumComponents); q.SetResultFilter(limitResults); } // Sort column should either be a standard or custom metaData field SortColumn paramSort; if (typeof(SortParameter).GetField(QuerySortField) != null) { paramSort = typeof(SortParameter).GetField(QuerySortField).GetValue(null) as SortColumn; } else { // Why do we need to tell Tridion what data type the field is! Its in the database already! /* FIX: Does not work (null pointer exception): var sType = typeof(MetadataType).GetField(SortType.ToString()).GetValue(null) as MetadataType;*/ paramSort = new CustomMetaKeyColumn(QuerySortField, SortType); } SortDirection paramSortDirection = typeof(SortParameter).GetField(QuerySortOrder.ToString()).GetValue(null) as SortDirection; SortParameter sortParameter = new SortParameter(paramSort, paramSortDirection); q.AddSorting(sortParameter); return(q); }
/// <summary> /// Executes the specified <see cref="T:TcmCDService.Contracts.BrokerQuery" /> /// </summary> /// <param name="brokerQuery"><see cref="T:TcmCDService.Contracts.BrokerQuery" /></param> /// <returns><see cref="I:System.Collections.Generic.IEnumerable{System.String}" /></returns> public static IEnumerable <String> Execute(BrokerQuery brokerQuery) { if (brokerQuery != null) { List <IDisposable> disposableItems = new List <IDisposable>(); List <Criteria> criteria = new List <Criteria>(); try { // Query for ItemType: Component if (brokerQuery.ItemType != 0) { criteria.Add(new ItemTypeCriteria((int)brokerQuery.ItemType)); } // Query for Publication if (!String.IsNullOrEmpty(brokerQuery.Publication)) { criteria.Add(new PublicationCriteria(new TcmUri(brokerQuery.Publication).ItemId)); } // Query based on Schema if (brokerQuery.SchemaUris != null && brokerQuery.SchemaUris.Any()) { criteria.Add(CriteriaFactory.Or(brokerQuery.SchemaUris.Select((u) => { ItemSchemaCriteria itemSchemaCriteria = new ItemSchemaCriteria(new TcmUri(u).ItemId); disposableItems.Add(itemSchemaCriteria); return(itemSchemaCriteria); }).ToArray())); } // Query based on Component Template if (!String.IsNullOrEmpty(brokerQuery.ComponentTemplateUri)) { criteria.Add(new ItemTemplateCriteria(new TcmUri(brokerQuery.ComponentTemplateUri).ItemId)); } // Add any SubQuery entries (MetaQuery or KeywordQueries which are specified) if (brokerQuery.SubQueries != null && brokerQuery.SubQueries.Any()) { criteria.AddRange(brokerQuery.SubQueries.Where(q => q != null).Select((q) => { Criteria subCriteria = q is MetaQuery ? ToCriteria(q as MetaQuery) : ToCriteria(q as KeywordQuery); disposableItems.Add(subCriteria); return(subCriteria); })); } using (Tridion.ContentDelivery.DynamicContent.Query.Query query = new Tridion.ContentDelivery.DynamicContent.Query.Query(CriteriaFactory.And(criteria.ToArray()))) { // Limit the amount of results using (LimitFilter filter = new LimitFilter(brokerQuery.ResultLimit.GetValueOrDefault(100))) { query.SetResultFilter(filter); query.AddSorting(new SortParameter(SortParameter.ItemModificationDate, SortParameter.Descending)); return(query.ExecuteQuery()); } } } finally { // Ensure all created Java objects are disposed foreach (Criteria entry in criteria) { if (entry != null) { entry.Dispose(); } } foreach (IDisposable entry in disposableItems) { if (entry != null) { entry.Dispose(); } } } } return(new String[] { }); }