コード例 #1
0
        /// <summary>
        /// Gets configuration data and returns it in a server configuration object
        /// </summary>
        /// <returns></returns>
        public ServerConfiguration GetConfiguration()
        {
            // instantiate the object
            ServerConfiguration serverConfiguration = new ServerConfiguration();

            // set app settings
            serverConfiguration.AppSettings = new List <AppSetting>();
            foreach (string name in ConfigurationManager.AppSettings)
            {
                serverConfiguration.AppSettings.Add(new AppSetting()
                {
                    Key = name, Value = ConfigurationManager.AppSettings[name]
                });
            }

            // create list of section settings
            serverConfiguration.SectionSettings = new List <ConfigurableSettingsData>();

            // add facebook section
            serverConfiguration.AddSettingsFromConfig <FacebookSettings, FacebookSection>(CONFIG_ENCRYPTION_KEY, "facebookConfig");

            return(serverConfiguration);
        }