Exemplo n.º 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);
        }
Exemplo n.º 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;
        }
Exemplo n.º 3
0
 public static IContext CreateDefault(BaseLogger baseLogger, IArguments arguments, BaseCacheStore cacheStore)
 {
     return _defaultContext ?? (_defaultContext = new CurrentContext(baseLogger, arguments, cacheStore));
 }
Exemplo n.º 4
0
 private CurrentContext(BaseLogger baseLogger, IArguments arguments, BaseCacheStore cacheStore)
 {
     Log = baseLogger;
     ApplicationParams = arguments;
     Cache = cacheStore;
 }
Exemplo n.º 5
0
 public static IContext CreateDefault(BaseLogger baseLogger, IArguments arguments, BaseCacheStore cacheStore)
 {
     return(_defaultContext ?? (_defaultContext = new CurrentContext(baseLogger, arguments, cacheStore)));
 }
Exemplo n.º 6
0
 private CurrentContext(BaseLogger baseLogger, IArguments arguments, BaseCacheStore cacheStore)
 {
     Log = baseLogger;
     ApplicationParams = arguments;
     Cache             = cacheStore;
 }