Example #1
0
        /// <summary>
        /// Clears the cached services.
        /// </summary>
        public static void ClearCachedServices()
        {
            lock (ServiceCacheLock)
            {
                foreach (NamingService service in ServiceCache.Values)
                {
                    service.Dispose();
                }

                ServiceCache.Clear();
                defaultNamingService = null;
            }
        }
Example #2
0
        public static NamingService GetNamingService(CultureInfo culture)
        {
            if (culture == null)
            {
                throw new ArgumentNullException("culture");
            }

            lock (ServiceCacheLock)
            {
                NamingService service;
                if (!ServiceCache.TryGetValue(culture.Name, out service))
                {
                    service = new NamingService(culture);
                    ServiceCache[culture.Name] = service;
                }

                return service;
            }
        }
 /// <summary>
 /// Returns true if the word is spelled correctly.
 /// </summary>
 /// <param name="namingService">
 /// The naming service to use.
 /// </param>
 /// <param name="word">
 /// The word to check.
 /// </param>
 /// <returns>
 /// True if spelled correct.
 /// </returns>
 private static bool IsSpelledCorrectly(NamingService namingService, string word)
 {
     return (namingService.GetPreferredAlternateForDeprecatedWord(word) == null) && (namingService.GetCompoundAlternateForDiscreteWord(word) == null)
            && (namingService.CheckSpelling(word) != WordSpelling.Unrecognized);
 }