private ServiceLocator() { switch(ConfigurationManager.AppSettings["AVD.Common.Caching.Distributed"]) { case "Redis": var redis = RedisPersistentCacheManager.Instance; if (!redis.IsConnected()) { Logger.Instance.Error(GetType().Name, "ServiceLocator", "Could not load up cache - reverting to Db"); persistentCache = new DbCacheManager(); } persistentCache = redis; distributedDictionaryProvider = redis; break; case "DBCache": default: persistentCache = new DbCacheManager(); distributedDictionaryProvider = null; // not available. break; } cachingManager = new CachingManager(); }
/// <summary> /// Initializes the non repository members. /// </summary> private void InitNonRepositoryMembers() { if (!AutoMapperConfiguration.Initialized) AutoMapperConfiguration.Configure(); var myQuotesListLengt = ConfigurationManager.AppSettings["AGENT_QUOAVDS_NUMBER_OF_RECENT_QUOAVDS_TO_LOAD"]; DbCacheManager = ServiceLocator.PersistentCache; }
public UserManager() { UserRepository = new Lazy<IRepository<User>>(() => RepositoryFactory.Get<User>()); DbCacheManager = ServiceLocator.PersistentCache; }