21 lines
753 B
C#
21 lines
753 B
C#
using System.Reflection;
|
|
using Telegram.Bot.SpaceApi.Backend.Database.Tables;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Telegram.Bot.SpaceApi.Backend.Database;
|
|
|
|
public class DatabaseContext : DbContext {
|
|
public DatabaseContext() { }
|
|
|
|
public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options) { }
|
|
|
|
public virtual DbSet<Config> Config { get; set; } = null!;
|
|
public virtual DbSet<Tables.Bot> Bots { get; set; } = null!;
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) => optionsBuilder.UseSqlite("Data Source=database.db");
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder) {
|
|
modelBuilder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly());
|
|
}
|
|
}
|