/// <summary> /// Retrieves the <see cref="ObjectCache"/>. /// </summary> /// <param name="objectCacheName">The configuration name of the cache.</param> /// <returns>The cache.</returns> private static ObjectCache GetCache(string objectCacheName) { var cache = CrmConfigurationManager.GetObjectCaches(objectCacheName).FirstOrDefault() ?? CrmConfigurationManager.CreateObjectCache(objectCacheName); return(cache); }
private static IEnumerable <ObjectCache> GetCaches(string objectCacheName) { var caches = CrmConfigurationManager.GetObjectCaches(objectCacheName); if (caches.Any()) { return(caches); } return(new[] { CrmConfigurationManager.CreateObjectCache(objectCacheName) }); }