using ErsatzTV.Core.AggregateModels; using ErsatzTV.Core.Domain; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; namespace ErsatzTV.Infrastructure.Data { public class TvContext : DbContext { private readonly ILoggerFactory _loggerFactory; public TvContext(DbContextOptions options, ILoggerFactory loggerFactory) : base(options) => _loggerFactory = loggerFactory; public DbSet ConfigElements { get; set; } public DbSet Channels { get; set; } public DbSet MediaSources { get; set; } public DbSet LocalMediaSources { get; set; } public DbSet PlexMediaSources { get; set; } public DbSet MediaItems { get; set; } public DbSet MediaCollections { get; set; } public DbSet SimpleMediaCollections { get; set; } public DbSet TelevisionMediaCollections { get; set; } public DbSet ProgramSchedules { get; set; } public DbSet Playouts { get; set; } public DbSet PlayoutItems { get; set; } public DbSet PlayoutProgramScheduleItemAnchors { get; set; } public DbSet FFmpegProfiles { get; set; } public DbSet Resolutions { get; set; } // support raw sql queries public DbSet MediaCollectionSummaries { get; set; } public DbSet GenericIntegerIds { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) => optionsBuilder.UseLoggerFactory(_loggerFactory); protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); builder.ApplyConfigurationsFromAssembly(typeof(TvContext).Assembly); } } }