/// <summary> /// Gets a dictionary of key/values directly from the database, no scope, nothing. /// </summary> /// <remarks>Used by <see cref="CoreRuntimeBootstrapper"/> to determine the runtime state.</remarks> public static IReadOnlyDictionary <string, string?>?GetFromKeyValueTable(this IUmbracoDatabase database, string keyPrefix) { if (database is null) { return(null); } // create the wildcard where clause ISqlSyntaxProvider sqlSyntax = database.SqlContext.SqlSyntax; var whereParam = sqlSyntax.GetStringColumnWildcardComparison( sqlSyntax.GetQuotedColumnName("key"), 0, TextColumnType.NVarchar); var sql = database.SqlContext.Sql() .Select <KeyValueDto>() .From <KeyValueDto>() .Where(whereParam, keyPrefix + sqlSyntax.GetWildcardPlaceholder()); return(database.Fetch <KeyValueDto>(sql) .ToDictionary(x => x.Key !, x => x.Value)); }