public RepositoryConfiguration(IConfigurationReader config) { try { databaseId = config.GetValue <string>(DataBaseIdKey); databaseUri = UriFactory.CreateDatabaseUri(databaseId); endPointUrl = config.GetValue <string>(EndPointUrlKey); authKey = config.GetValue <string>(AuthConfigKey).ToSecureString(); docDbClient = new DocumentClient(new Uri(endPointUrl), authKey); userCollectionId = config.GetValue <string>(UserCollectionIdKey); productCollectionId = config.GetValue <string>(ProductCollectionIdKey); collectionIds = new List <string> { userCollectionId, productCollectionId }; CreateDatabaseIfNotExistsAsync().Wait(); } catch (Exception) { // TODO : Handle exception. throw; } }
public IActionResult Index() { HomePageModel model = new HomePageModel { SupportedOs = _configReader.GetValue <string>("SupportedOs"), ApiVersion = _configReader.GetValue <double>("ApiVersion"), IsDebug = _configReader.GetValue <bool>("IsDebug"), Miliseconds = _configReader.GetValue <int>("Miliseconds") }; return(View(model)); }
public IActionResult Index() { var configItem = _configReader.GetValue <string>("SiteName"); var configModel = new ProjectConfigModel { Name = "SiteName", Value = configItem }; // bu değer aktif olmadığından gelmemeli var configItem2 = _configReader.GetValue <int?>("MaxItemCount"); return(View(configModel)); }
public IActionResult Index() { var result = _configurationReader.GetValue <string>("SiteName"); ViewBag.Result = result; return(View()); }
public void TestMethod_GetValue_ServiceB() { _reader = new ConfigurationReader("SERVICE-B", ConfigurationManager.ConnectionStrings["TrendyolEntities"].ConnectionString, 1000); bool isBasketEnabled = _reader.GetValue <bool>("IsBasketEnabled"); Assert.AreEqual(true, isBasketEnabled); }
public void TestMethod_GetValue_ServiceA() { _reader = new ConfigurationReader("SERVICE-A", ConfigurationManager.ConnectionStrings["TrendyolEntities"].ConnectionString, 1000); string siteName = _reader.GetValue <string>("SiteName"); Assert.AreEqual("trendyol.com", siteName); }
public void OnGet(string searchString) { CurrentFilter = searchString; if (!string.IsNullOrWhiteSpace(searchString)) { CacheSearchResult = _configurationReader.GetValue <string>(searchString); ConfigurationList = _configurationReader.SearchByName(searchString).Select(a => new Configuration { Type = a.Type, Value = a.Value, IsActive = a.IsActive, Name = a.Name, Id = a.Id }).ToList(); } else { ConfigurationList = _configurationReader.GetAll().Select(a => new Configuration { Type = a.Type, Value = a.Value, IsActive = a.IsActive, Name = a.Name, Id = a.Id }).ToList(); } }
public ActionResult Get(string key, string type) { dynamic value = null; if (type == "string") { value = _configurationReader.GetValue <string>(key); } else if (type == "bool") { value = _configurationReader.GetValue <bool>(key); } else if (type == "int") { value = _configurationReader.GetValue <int>(key); } return(Ok(value)); }
static void Main(string[] args) { ConfigSettings.ApplicationName = "ServiceA"; ConfigSettings.ConnectionString = "mongodb://localhost:27017"; ConfigSettings.RefreshTimerIntervalInMs = 5000; _container = DependencyService.Instance.CurrentResolver; IConfigurationReader _configurationReader = _container.Resolve <IConfigurationReader>(); string siteName = _configurationReader.GetValue <string>("SiteName"); Console.WriteLine("Sitename: " + siteName); bool isBasketEnabled = _configurationReader.GetValue <bool>("IsBasketEnabled"); Console.WriteLine("IsBasketEnabled" + isBasketEnabled); Console.ReadKey(); }
static void Main(string[] args) { Arguments prms = new Arguments(); prms.Add("applicationName", "SERVICE - A"); prms.Add("refreshTimerIntervalInMs", 10000); prms.Add("connectionString", "Deneme"); IConfigurationReader configurationReader = IocHelper.Resolve <IConfigurationReader>(prms); var val = configurationReader.GetValue <int>("MaxItemCount"); Console.ReadKey(); }
protected override async Task ExecuteAsync(CancellationToken stoppingToken) { while (!stoppingToken.IsCancellationRequested) { try { _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); var value = _configurationReader.GetValue <string>("SiteName"); _logger.LogInformation($"Loaded value {value} for the settings key 'SiteName'"); await Task.Delay(TimeSpan.FromSeconds(20), stoppingToken); } catch (Exception e) { _logger.LogError(e, "Well, we'll keep working..."); } } }
public void When_Call_Not_ActiveValue_Then_It_Should_Return_Null(string name) { var configItem2 = _configReader.GetValue <int?>("MaxItemCount"); Assert.IsTrue(configItem2 == null); }
public void Get_value() { var val = _configurationReader.GetValue <int>("MaxItemCount"); }
public T GetValue <T>(string key) => _advancedConfigurationReader.GetValue <T>(key);
public void No_Configuration_Throws() { Should.Throw <InvalidOperationException>(() => _configurationReader.GetValue <bool>("key")); }