Files
TimetableDesigner.Backend.S…/TimetableDesigner.Backend.Services.Authentication.Database/DatabaseContext.cs

23 lines
830 B
C#
Raw Normal View History

2025-09-24 19:36:28 +02:00
using System.Reflection;
using Microsoft.EntityFrameworkCore;
2026-01-11 02:30:08 +01:00
using TimetableDesigner.Backend.Services.Authentication.Database.Model;
2025-09-24 19:36:28 +02:00
2026-01-11 02:30:08 +01:00
namespace TimetableDesigner.Backend.Services.Authentication.Database;
2025-09-24 19:36:28 +02:00
public class DatabaseContext : DbContext
{
public virtual DbSet<Account> Accounts { get; set; }
public virtual DbSet<RefreshToken> RefreshTokens { get; set; }
public DatabaseContext() { }
public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options) { }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) =>
optionsBuilder.UseNpgsql("name=Database");
protected override void OnModelCreating(ModelBuilder modelBuilder) =>
modelBuilder.ApplyConfigurationsFromAssembly(Assembly.GetAssembly(typeof(DatabaseContext))!);
}