From 38c60cee378b9c2ad42fc9dc79bc492b919a68f5 Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Tue, 15 Aug 2023 15:49:14 +1000 Subject: Convert Razor pages to Blazor --- HyperBooruContext.cs | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 HyperBooruContext.cs (limited to 'HyperBooruContext.cs') diff --git a/HyperBooruContext.cs b/HyperBooruContext.cs deleted file mode 100644 index 3a9aa0f..0000000 --- a/HyperBooruContext.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using System.Text.Json; - -namespace HyperBooru; - -public class HyperBooruDbContext : DbContext { - public DbSet Objects { get; set; } - public DbSet TagDefinitions { get; set; } - public DbSet Tags { get; set; } - public DbSet Media { get; set; } - public DbSet UploadedFiles { get; set; } - - private IConfigService config; - - public HyperBooruDbContext(IConfigService config) => - this.config = config; - - protected override void OnConfiguring(DbContextOptionsBuilder options) { - options.UseLazyLoadingProxies(); - - var path = Path.Join(config.DataPath, "HyperBooru.db"); - options.UseSqlite($"Data Source = {config.DbPath}"); - } - - protected override void OnModelCreating(ModelBuilder modelBuilder) { - modelBuilder.Entity().ToTable("Objects"); - modelBuilder.Entity().ToTable("TagDefinitions"); - modelBuilder.Entity().ToTable("Tags"); - modelBuilder.Entity().ToTable("Media"); - modelBuilder.Entity().ToTable("UploadedFiles"); - - modelBuilder.Entity().HasData(new DbTagDefinition[] { - new() { ObjectId = -1, Source = TagSource.Internal, Name = "nsfw" }, - new() { ObjectId = -2, Source = TagSource.Internal, Name = "ingest" } - }); - } -} \ No newline at end of file -- cgit v1.3