2024-07-19 17:08:37 +00:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Numerics;
|
|
|
|
|
|
2024-08-15 19:46:43 +00:00
|
|
|
|
namespace StarsAssistant.Model;
|
2024-07-19 17:08:37 +00:00
|
|
|
|
|
|
|
|
|
public class StarsDatabase(string DbPath) : DbContext
|
|
|
|
|
{
|
|
|
|
|
#region Configuration and Construction
|
|
|
|
|
|
|
|
|
|
public string DbPath { get; } = DbPath;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Configure for SQLite and set the DB Path given.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="options">Options to update</param>
|
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
|
|
|
|
=> options.UseSqlite($"Data Source={DbPath}");
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
2024-09-11 18:04:20 +00:00
|
|
|
|
#region IStarsDatabase Implementation
|
|
|
|
|
|
|
|
|
|
public DbContext DbContext => this;
|
2024-07-19 17:08:37 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// List of all Planets read.
|
|
|
|
|
/// </summary>
|
2024-08-18 17:21:18 +00:00
|
|
|
|
public DbSet<Planet> Planet { get; set; }
|
2024-07-19 17:08:37 +00:00
|
|
|
|
|
2024-08-17 14:52:31 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Lists of all defined races.
|
|
|
|
|
/// </summary>
|
2024-08-18 17:21:18 +00:00
|
|
|
|
public DbSet<Race> Race { get; set; }
|
2024-08-17 14:52:31 +00:00
|
|
|
|
|
2024-09-15 20:10:44 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The record with all game metadata, will only contain a single line at all times.
|
|
|
|
|
/// </summary>
|
2024-09-17 18:20:42 +00:00
|
|
|
|
// public DbSet<Game> Game { get; set; }
|
2024-09-15 20:10:44 +00:00
|
|
|
|
|
2024-07-19 17:08:37 +00:00
|
|
|
|
#endregion
|
|
|
|
|
}
|