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 DatabaseContext : DbContext { public DatabaseContext() { Details = Task.Run(async () => await DetailsHelper.GetDetails()).GetAwaiter().GetResult(); } public DbSet
Articles; public DbSet Configs; public Dictionary Details; protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { base.OnConfiguring(optionsBuilder); optionsBuilder.UseMySQL($"server=localhost;port=3306;user={Details["username"]};password={Details["password"]};database={Details["database"]}"); } } }