freetubesync/FreeTubeSync/Database/DataContext.cs
Mario Steele 4985dc4179 Started the Split
Split Json data models coming from REST Api, from the Database models
storing them in a SQLite database.
Work to re-engineer endpoints to use Database objects, and copy/update
data from the json objects.
More work is needed.
2025-07-22 17:03:33 -05:00

29 lines
No EOL
895 B
C#

using FreeTubeSync.Model.Database;
using Microsoft.EntityFrameworkCore;
namespace FreeTubeSync.Database;
public class DataContext : DbContext
{
public DataContext(DbContextOptions<DataContext> options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Profile>()
.Navigation(e => e.subscriptions).AutoInclude();
modelBuilder.Entity<Playlist>()
.Navigation(e => e.videos).AutoInclude();
}
public DbSet<History> Histories { get; set; }
public DbSet<Playlist> Playlists { get; set; }
public DbSet<Profile> Profiles { get; set; }
public DbSet<SearchHistory> SearchHistories { get; set; }
public DbSet<Setting> Settings { get; set; }
public DbSet<Subscription> Subscriptions { get; set; }
public DbSet<Video> Videos { get; set; }
}