Exemple #1
0
        public static BaseCacheStore Create(ICacheConfiguration cacheConfiguration)
        {
            if (cacheConfiguration == null)
            {
                throw new ArgumentNullException("cacheConfiguration");
            }

            if (_instance == null)
            {
                Type providerType = Type.GetType(cacheConfiguration.ProviderType);
                if (providerType == null)
                {
                    throw new InvalidConfigurationException("Could not locate Cache Provider :" +
                                                            cacheConfiguration.ProviderType);
                }

                if (!providerType.ImplementsClass <BaseCacheStore>())
                {
                    throw new InvalidConfigurationException("Cache Provider does not implement BaseCacheStore:" +
                                                            cacheConfiguration.ProviderType);
                }

                _instance = (BaseCacheStore)Activator.CreateInstance(providerType, cacheConfiguration);
            }

            return(_instance);
        }
Exemple #2
0
        public static BaseCacheStore Create(ICacheConfiguration cacheConfiguration)
        {
            if (cacheConfiguration == null)
                throw new ArgumentNullException("cacheConfiguration");

            if (_instance == null)
            {
                Type providerType = Type.GetType(cacheConfiguration.ProviderType);
                if (providerType == null)
                    throw new InvalidConfigurationException("Could not locate Cache Provider :" +
                                                            cacheConfiguration.ProviderType);

                if (!providerType.ImplementsClass<BaseCacheStore>())
                    throw new InvalidConfigurationException("Cache Provider does not implement BaseCacheStore:" +
                                                            cacheConfiguration.ProviderType);

                _instance = (BaseCacheStore) Activator.CreateInstance(providerType, cacheConfiguration);
            }

            return _instance;
        }
 public static IContext CreateDefault(BaseLogger baseLogger, IArguments arguments, BaseCacheStore cacheStore)
 {
     return _defaultContext ?? (_defaultContext = new CurrentContext(baseLogger, arguments, cacheStore));
 }
 private CurrentContext(BaseLogger baseLogger, IArguments arguments, BaseCacheStore cacheStore)
 {
     Log = baseLogger;
     ApplicationParams = arguments;
     Cache = cacheStore;
 }
Exemple #5
0
 public static IContext CreateDefault(BaseLogger baseLogger, IArguments arguments, BaseCacheStore cacheStore)
 {
     return(_defaultContext ?? (_defaultContext = new CurrentContext(baseLogger, arguments, cacheStore)));
 }
Exemple #6
0
 private CurrentContext(BaseLogger baseLogger, IArguments arguments, BaseCacheStore cacheStore)
 {
     Log = baseLogger;
     ApplicationParams = arguments;
     Cache             = cacheStore;
 }