mirror of
https://github.com/SamueleLorefice/isleBot.git
synced 2026-01-15 06:03:42 +00:00
Converted the project in C#, added Entity Framework Core.
This commit is contained in:
21
DbManager.cs
Normal file
21
DbManager.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace IsleBot;
|
||||
|
||||
public class DbManager : DbContext {
|
||||
public DbSet<User> Players { get; set; }
|
||||
public DbSet<Card> Cards { get; set; }
|
||||
public DbSet<Match> Matches { get; set; }
|
||||
|
||||
public string dbpath { get; } = "database.db";
|
||||
|
||||
public DbManager() {
|
||||
var fullPath = Environment.CurrentDirectory + Path.DirectorySeparatorChar + dbpath;
|
||||
dbpath = fullPath;
|
||||
}
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
=> optionsBuilder.UseSqlite($"Data Source={dbpath}");
|
||||
}
|
||||
Reference in New Issue
Block a user