コード例 #1
0
        /// <summary>
        /// Gets a configuration value
        /// </summary>
        /// <typeparam name="T">Type of the configuration value</typeparam>
        /// <param name="ConfigKey">Key to locate the configration in the category</param>
        /// <param name="ConfigCategory">Category of the configuration</param>
        /// <param name="Default">Default value if none exists</param>
        /// <returns>Saved value</returns>
        public T GetConfig <T>(string ConfigKey, string ConfigCategory, T Default)
        {
            var values = internalDb.Query <T>("SELECT Value FROM nsConfig WHERE Id = @id",
                                              new { id = buildKey(ConfigKey, ConfigCategory) })
                         .ToArray();

            if (values.Length == 0)
            {
                return(Default);
            }
            return(values[0]);
        }
コード例 #2
0
 /// <summary>
 /// Retrieves all stored Keys
 /// </summary>
 public IEnumerable <string> GetAllKeys()
 {
     return(internalDb.Query <string>("SELECT Id FROM nsDocuments", null));
 }