// // @function Configure // @brief This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, TranslationDb context) { // @note Failed to make logging to console work - JSolsvik 09.08.17 loggerFactory.AddConsole() .AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseDefaultFiles(); // @doc caching static files https://andrewlock.net/adding-cache-control-headers-to-static-files-in-asp-net-core/ app.UseStaticFiles(new StaticFileOptions { OnPrepareResponse = ctx => { const int durationInSeconds = 60 * 60 * 24; ctx.Context.Response.Headers[HeaderNames.CacheControl] = "public,max-age=" + durationInSeconds; } }); app.UseMvc(); app.UseResponseCompression(); app.UseResponseCaching(); // @note Only use this when the database is empty. //TranslationDb.Seed(context); }
// // TESTDATA add // public static void AddTestData(TranslationDb context) { context.Container.AddRange( new Container { Key = "Main" }, new Container { Key = "Special" } ); }
public void InitializeTranslationDb(string specificPath = null) { TranslationDb = new TranslationDb(Owner.DiskCache.FsAbstraction, new ConsoleLogger()); TranslationDb.AddLanguage(DefaultLanguage ?? "en-us"); if (specificPath == null) { TranslationDb.LoadLangDbs(PathUtils.Join(Owner.Owner.FullPath, "translations")); } else { TranslationDb.LoadLangDb(specificPath); } }
// // SET containers and langugaes on client // // // TESTDATA // public static void AddTestData(TranslationDb context) { context.Client.AddRange( new Client { Key = "FMSF", ApiKey = "1", ThumbnailUrl = "http://placehold.it/250x125/FFC107", WebpageUrl = "https://fmsf.plaholder.magic" }, new Client { Key = "DIFI", ApiKey = "2", ThumbnailUrl = "http://placehold.it/250x125/FFC107", WebpageUrl = "https://difi.plaholder.magic" }, new Client { Key = "Skatteetaten", ApiKey = "3", ThumbnailUrl = "http://placehold.it/250x125/FFC107", WebpageUrl = "https://skatteetaten.plaholder.magic" } ); context.SaveChanges(); }
// // TESTDATA // public static void AddTestData(TranslationDb context) { context.Language.AddRange( new Language { Name = "Norwegian", Key = "no-nb" }, new Language { Name = "Swedish", Key = "sv" }, new Language { Name = "Danish", Key = "da" }, new Language { Name = "English", Key = "en" } ); context.SaveChanges(); }
// // TESTDATA translation // public static void AddTestData(TranslationDb context) { context.Translation.AddRange( new Translation { ClientKey = "FMSF", LanguageKey = "en", ContainerKey = "Main", Key = "hello_world", Text = "Hello World", IsComplete = true, }, new Translation { ClientKey = "FMSF", LanguageKey = "no-nb", ContainerKey = "Main", Key = "hello_world", Text = "Hallo verden", IsComplete = false, }, new Translation { ClientKey = "DIFI", LanguageKey = "en", ContainerKey = "Special", Key = "this_is_me", Text = "This is me!", IsComplete = false, }, new Translation { ClientKey = "DIFI", LanguageKey = "no-nb", ContainerKey = "Special", Key = "this_is_me", Text = "Dette er meg!", IsComplete = true, } ); context.SaveChanges(); }
public LanguageRepository(TranslationDb context) { _context = context; }
public ClientRepository(TranslationDb context) { _context = context; }
public ContainerRepository(TranslationDb context) { _context = context; }
public TranslationRepository(TranslationDb context) { _context = context; }