30 lines
No EOL
948 B
C#
30 lines
No EOL
948 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; }
|
|
public DbSet<ChangeLog> ChangeLogs { get; set; }
|
|
} |