From 629a4cc2b86faed2732829faf5421f50a5a67b81 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Mon, 4 Feb 2019 12:27:17 +0000 Subject: Made a property for details and used it in OnConfiguring method --- Database/Database.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'Database/Database.cs') diff --git a/Database/Database.cs b/Database/Database.cs index f687efd..5bc33b7 100644 --- a/Database/Database.cs +++ b/Database/Database.cs @@ -1,15 +1,24 @@ using System; -using Classes; +using System.Threading; +using System.Threading.Tasks; +using System.Collections.Generic; + using Microsoft.EntityFrameworkCore; using MySql.Data.EntityFrameworkCore; +using Classes; + namespace Database { - public class Database: DbContext { + public class Database : DbContext { + public Database() { + Details = Task.Run(async () => await DetailsHelper.GetDetails()).GetAwaiter().GetResult(); + } public DbSet
Articles; public DbSet Configs; + public static Dictionary Details; protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { - // optionsBuilder.UseMySQL("server=localhost;uid") + optionsBuilder.UseMySQL($"server=localhost;uid={Details["username"]};password={Details["password"]};database=news_aggregator"); } } } -- cgit v1.2.3-13-gbd6f