Ejemplo n.º 1
0
        private IEnumerable <SiteConfigurationRow> GetSiteConfigurationRows()
        {
            List <SiteConfigurationRow> configurationRows = new List <SiteConfigurationRow>();

            // Turn the main SiteSettings into a row
            SiteSettings         settings = _repository.GetSiteSettings();
            SiteConfigurationRow row      = new SiteConfigurationRow()
            {
                Id      = SiteSettings.SiteSettingsId,
                Version = ApplicationSettings.FileVersion,
                Json    = settings.GetJson()
            };

            configurationRows.Add(row);

            // Turn all plugin settings into rows
            IEnumerable <TextPlugin> plugins = _pluginFactory.GetTextPlugins();

            foreach (TextPlugin plugin in plugins)
            {
                row = new SiteConfigurationRow()
                {
                    Id      = plugin.DatabaseId,
                    Version = plugin.Version,
                    Json    = plugin.GetSettingsJson()
                };

                configurationRows.Add(row);
            }

            return(configurationRows);
        }
Ejemplo n.º 2
0
        internal string GetSiteConfigurationInsertSql(SiteConfigurationRow row)
        {
            if (row == null)
            {
                return("");
            }

            string sql = "INSERT INTO roadkill_siteconfiguration (id, version, content) VALUES (";

            sql += string.Format("'{0}',", row.Id);
            sql += string.Format("'{0}',", row.Version);
            sql += string.Format("'{0}'", row.Json.ReplaceSingleQuotes());

            sql += ");";

            return(sql);
        }