diff options
| author | Jake Mannens <jake@asger.xyz> | 2023-08-08 13:20:21 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2023-08-08 13:20:21 +1000 |
| commit | 701d474949e5cb72b8ed7b29fec45ad74580f570 (patch) | |
| tree | 0eea7adfdd9d7dde4dd44535cd172d7e6a4f8737 /HyperBooruContext.cs | |
Initial commit
Diffstat (limited to 'HyperBooruContext.cs')
| -rw-r--r-- | HyperBooruContext.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/HyperBooruContext.cs b/HyperBooruContext.cs new file mode 100644 index 0000000..8223ee3 --- /dev/null +++ b/HyperBooruContext.cs @@ -0,0 +1,24 @@ +using Microsoft.EntityFrameworkCore; +using System.Text.Json; + +namespace HyperBooru; + +public class HyperBooruDbContext : DbContext { + public DbSet<DbObject> Objects { get; set; } + public DbSet<DbTagDefinition> TagDefinitions { get; set; } + public DbSet<DbTag> Tags { get; set; } + public DbSet<DbMedia> Media { get; set; } + public DbSet<DbUploadedFile> 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}"); + } +}
\ No newline at end of file |
