private RedisCacheConnectionSettings ReadConfiguration() { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddEnvironmentVariables(); var config = builder.Build(); var connectionInfo = new RedisCacheConnectionSettings { RedisCacheName = config["RedisCacheName"], RedisCachePassword = config["RedisCachePassword"] }; if (string.IsNullOrEmpty(connectionInfo.RedisCacheName)) { builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json"); config = builder.Build(); connectionInfo = new RedisCacheConnectionSettings { RedisCacheName = config["RedisCacheName"], RedisCachePassword = config["RedisCachePassword"] }; } return(connectionInfo); }
public RedisConnect() { RedisConnection = ReadConfiguration(); }