using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; namespace ViraScraper.Models { public class ScrapDbContext : DbContext { public DbSet Hashtags { get; set; } public DbSet Synonymses { get; set; } public ScrapDbContext(DbContextOptions options) : base(options) { } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity() .HasOne() .WithMany() .HasForeignKey(s=>s.HashtagAId) .OnDelete(DeleteBehavior.Restrict); modelBuilder.Entity() .HasOne() .WithMany() .HasForeignKey(s => s.HashtagBId) .OnDelete(DeleteBehavior.Restrict); base.OnModelCreating(modelBuilder); } public override void Dispose() { } } }