using KTUSAPS.Data.Model; using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace KTUSAPS.Data { public class SAPSDataContext : DbContext { public SAPSDataContext() : base() { } public SAPSDataContext(DbContextOptions options) : base(options) { } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity() .HasKey(v => new { v.UserId, v.ProblemId }); } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { if (!optionsBuilder.IsConfigured) { optionsBuilder.UseMySql("Server=localhost;User=saps;Password=;Database=saps_dev", new MariaDbServerVersion(new Version(10, 6, 3))); } } public DbSet Issues { get; set; } public DbSet PublishedFeedbacks { get; set; } public DbSet PublishedProblems { get; set; } public DbSet Solutions { get; set; } public DbSet Votes { get; set; } public DbSet Admins { get; set; } } }