You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
leap-hit-server/code/server/DataBase/Context/PongDbContext.cs

30 lines
970 B

using DataBase.Entity;
using Microsoft.EntityFrameworkCore;
using System.Diagnostics;
using System.Reflection;
namespace DataBase.Context
{
public class PongDbContext : DbContext
{
public DbSet<Player> Players { get; set; }
public DbSet<Game> Games { get; set; }
public DbSet<Message> Messages { get; set; }
public DbSet<Chat> Chats { get; set; }
public PongDbContext() { }
public PongDbContext(DbContextOptions<PongDbContext> options) : base(options) { }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
//base.OnConfiguring(optionsBuilder);
if (!optionsBuilder.IsConfigured)
{
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "..\\..\\..\\..\\DataBase\\PongDB.db");
optionsBuilder.UseSqlite($"Data Source={path}");
}
}
}
}