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

23 lines
822 B
C#
Raw Normal View History

2025-09-24 19:36:28 +02:00
using System.Reflection;
using Microsoft.EntityFrameworkCore;
using TimetableDesigner.API.Services.Authentication.Database.Model;
namespace TimetableDesigner.API.Services.Authentication.Database;
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))!);
}