예제 #1
0
        /// <summary>
        /// 直接获取配置值,如果有多层则用冒号分割 eg.:
        /// var x = GetValue("ConnectionStrings:Default")
        /// </summary>
        /// <param name="sectionName"></param>
        /// <returns></returns>
        public static string GetValue(string sectionName, string projectName = CY_SystemConsts.ServiceProjectName)
        {
            IConfigurationRoot root = AppConfiguration.Get(projectName);

            return(root.GetSection(sectionName).Value);
        }