コード例 #1
0
        /// <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);
        }
コード例 #2
0
        private static IEnumerable <ObjectCache> GetCaches(string objectCacheName)
        {
            var caches = CrmConfigurationManager.GetObjectCaches(objectCacheName);

            if (caches.Any())
            {
                return(caches);
            }

            return(new[] { CrmConfigurationManager.CreateObjectCache(objectCacheName) });
        }