Beispiel #1
0
        public static string GetAppSetting(string key)
        {
            ValueHelper.CheckObjectEqualNull(key);
            var value = Configuration.GetSection("appSettings")
                        .GetChildren()
                        .Where(x => x.Key == key)
                        .FirstOrDefault()?.Value;

            ValueHelper.CheckObjectEqualNull(value);
            return(value);
        }
Beispiel #2
0
        public static string GetConnectionString(string key)
        {
            ValueHelper.CheckObjectEqualNull(key);
            var conStr = Configuration.GetSection("connectionStrings")
                         .GetChildren()
                         .Where(x => x.Key == key)
                         .FirstOrDefault()?.Value;

            ValueHelper.CheckObjectEqualNull(conStr);
            return(conStr);
        }