aboutsummaryrefslogtreecommitdiff
path: root/Database/Database.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Database/Database.cs')
-rw-r--r--Database/Database.cs15
1 files changed, 12 insertions, 3 deletions
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<Article> Articles;
public DbSet<Config> Configs;
+ public static Dictionary<string, string> 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");
}
}
}