mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2026-01-16 01:38:02 -05:00
22 lines
569 B
C#
22 lines
569 B
C#
using Common.Helpers;
|
|
using Data.Models.Events;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Data;
|
|
|
|
/// <summary>
|
|
/// Database context for events
|
|
/// </summary>
|
|
public class DataContext : DbContext
|
|
{
|
|
public DbSet<AppEvent> Events { get; set; }
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
if (!optionsBuilder.IsConfigured)
|
|
{
|
|
var dbPath = Path.Combine(ConfigurationPathProvider.GetSettingsPath(), "state.db");
|
|
optionsBuilder.UseSqlite($"Data Source={dbPath}");
|
|
}
|
|
}
|
|
} |