コード例 #1
0
ファイル: ConfigurationHelper.cs プロジェクト: B3RR/GONIS
        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);
        }
コード例 #2
0
ファイル: ConfigurationHelper.cs プロジェクト: B3RR/GONIS
        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);
        }