Example #1
0
        /// <summary>
        /// Caches the provider, both in the instance cache, and the type
        /// cache.
        /// </summary>
        private static void CacheProvider(Type type, LicenseProvider provider)
        {
            if (s_providers == null)
            {
                Interlocked.CompareExchange(ref s_providers, new Hashtable(), null);
            }

            lock (s_providers)
            {
                s_providers[type] = provider;
            }

            if (provider != null)
            {
                if (s_providerInstances == null)
                {
                    Interlocked.CompareExchange(ref s_providerInstances, new Hashtable(), null);
                }

                Type providerType = provider.GetType();
                lock (s_providerInstances)
                {
                    s_providerInstances[providerType] = provider;
                }
            }
        }
 private static void CacheProvider(Type type, LicenseProvider provider)
 {
     if (providers == null)
     {
         providers = new Hashtable();
     }
     providers[type] = provider;
     if (provider != null)
     {
         if (providerInstances == null)
         {
             providerInstances = new Hashtable();
         }
         providerInstances[provider.GetType()] = provider;
     }
 }
 private static void CacheProvider(Type type, LicenseProvider provider)
 {
     if (providers == null)
     {
         providers = new Hashtable();
     }
     providers[type] = provider;
     if (provider != null)
     {
         if (providerInstances == null)
         {
             providerInstances = new Hashtable();
         }
         providerInstances[provider.GetType()] = provider;
     }
 }