Пример #1
0
        /// <summary>
        /// 从单独的meta.config文件中读取meta配置
        /// </summary>
        /// <param name="fileSettings">ConfigFilesSetting 实体</param>
        /// <returns>MetaConfigurationSourceInstanceSection 实体</returns>
        private static MetaConfigurationSourceInstanceSection LoadMetaSourceInstanceSectionFromMetaFile(ConfigFilesSetting fileSettings)
        {
            System.Configuration.Configuration config = ConfigurationBroker.GetSingleFileConfiguration(
                fileSettings.MetaConfigurationFile,
                true,
                fileSettings.MachineConfigurationFile,
                fileSettings.LocalConfigurationFile);

            MetaConfigurationSectionGroup group =
                config.GetSectionGroup(ConfigurationBroker.MetaConfigurationSectionGroupItem) as MetaConfigurationSectionGroup;

            MetaConfigurationSourceInstanceSection section = null;

            if (group != null)
            {
                section = group.SourceConfigurationMapping;
            }

            return(section);
        }
Пример #2
0
        /// <summary>
        /// 从本地config文件中读取meta配置
        /// </summary>
        /// <param name="fileSettings">ConfigFilesSetting 类实例</param>
        /// <returns>MetaConfigurationSourceInstanceSection 实体</returns>
        private static MetaConfigurationSourceInstanceSection LoadMetaSourceInstanceSectionFromLocal(ConfigFilesSetting fileSettings)
        {
            System.Configuration.Configuration config;

            if (EnvironmentHelper.Mode == InstanceMode.Web)
            {
                config = ConfigurationBroker.GetStandardWebConfiguration(fileSettings.MachineConfigurationFile, true);
            }
            else
            {
                config = ConfigurationBroker.GetStandardExeConfiguration(fileSettings.MachineConfigurationFile, fileSettings.LocalConfigurationFile, true);
            }

            MetaConfigurationSectionGroup group =
                (MetaConfigurationSectionGroup)config.GetSectionGroup(ConfigurationBroker.MetaConfigurationSectionGroupItem);
            MetaConfigurationSourceInstanceSection section = null;

            if (group != null)
            {
                section = group.SourceConfigurationMapping;
            }

            return(section);
        }