private static string GetScript(string culture) { var script = new StringBuilder(); script.Append("var Resources = {"); var resources = DbResources.GetLocalizationTable(culture); var resourceClassGroup = resources .GroupBy(r => r.ResourceClass) .Select(group => group.ToList()) .ToList(); foreach (var resourceClass in resourceClassGroup) { int i = 0; foreach (var resource in resourceClass) { if (i == 0) { script.Append(resource.ResourceClass + ": {"); } script.Append(resource.Key + ": function(){ return \""); string localized = resource.Translated; if (string.IsNullOrWhiteSpace(localized)) { localized = resource.Original; } script.Append(HttpUtility.JavaScriptStringEncode(localized)); script.Append("\";"); script.Append("},"); i++; } script.Append("},"); } script.Append("};"); return(script.ToString()); }
private IDataSource GetDataSource() { var sourceName = Request.GetDataSource(); // TODO, get the DbResource based on the sourceName var dbResources = new DbResources { DbTables = new List <string> { "Table1" } }; var dataSource = new SqlDataSource(dbResources); return(dataSource); }
private static void InitializeResourcesAsync(string tenant) { IDictionary <string, string> resources = DbResources.GetLocalizedResources(tenant); CacheFactory.AddToDefaultCache("Resources", resources); }
private static async Task InitializeResourcesAsync(string tenant) { IDictionary <string, string> resources = await DbResources.GetLocalizedResourcesAsync(tenant).ConfigureAwait(false); CacheFactory.AddToDefaultCache("Resources", resources); }
public DebrisField() { Resources = new DbResources(); }
public DbPlanet() { Resources = new DbResources(); }