blob: 5bc33b706b861ca0e8ce8e1cfcf743f04911a58d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
using System;
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 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={Details["username"]};password={Details["password"]};database=news_aggregator");
}
}
}
|