using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Numerics;
namespace StarsAssistant.Model;
public class StarsDatabase(string DbPath) : DbContext
{
#region Configuration and Construction
public string DbPath { get; } = DbPath;
///
/// Configure for SQLite and set the DB Path given.
///
/// Options to update
protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlite($"Data Source={DbPath}");
///
/// Configure the model, force it to use property accessors we define.
///
/// model builder
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.UsePropertyAccessMode(PropertyAccessMode.Property);
}
#endregion
#region IStarsDatabase Implementation
public DbContext DbContext => this;
///
/// List of all Planets read.
///
public DbSet Planet { get; set; }
///
/// Lists of all defined races.
///
public DbSet Race { get; set; }
///
/// The record with all game metadata, will only contain a single line at all times.
///
public DbSet Game { get; set; }
#endregion
}