//----------------------------------------------------------------------- // FILENAME: LibraryContext.cs // PROJECT: DbContextLib // SOLUTION: FitnessApp // DATE CREATED: 22/02/2024 // AUTHOR: Antoine PEREDERII //----------------------------------------------------------------------- using Entities; using Microsoft.EntityFrameworkCore; namespace DbContextLib { /// /// Represents the database context for the FitnessApp. /// public class LibraryContext : DbContext { /// /// Gets or sets the set of athletes. /// public DbSet AthletesSet { get; set; } /// /// Gets or sets the set of activities. /// public DbSet ActivitiesSet { get; set; } /// /// Gets or sets the set of data sources. /// public DbSet DataSourcesSet { get; set; } /// /// Gets or sets the set of heart rates. /// public DbSet HeartRatesSet { get; set; } /// /// Gets or sets the set of notifications. /// public DbSet NotificationsSet { get; set; } /// /// Gets or sets the set of statistics. /// public DbSet StatisticsSet { get; set; } /// /// Gets or sets the set of trainings. /// public DbSet TrainingsSet { get; set; } /// /// Initializes a new instance of the class. /// public LibraryContext() : base() { } /// /// Initializes a new instance of the class with the specified options. /// /// The options for the context. public LibraryContext(DbContextOptions options) : base(options) { } /// /// Configures the database options if they are not already configured. /// /// The options builder instance. protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { if (!optionsBuilder.IsConfigured) { optionsBuilder.UseSqlite($"Data Source=uca.HeartTrack.db"); } } /// /// Configures the model for the library context. /// /// The model builder instance. protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); } } }