techgarage-ir.MTWireGuard/DBContext.cs

23 lines
567 B
C#
Raw Normal View History

2023-03-03 23:24:18 +03:30
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Hosting;
using MTWireGuard.Models.Mikrotik;
namespace MTWireGuard
{
public class DBContext : DbContext
{
public DbSet<WGPeerDBModel> Users { get; set; }
public string DbPath { get; }
public DBContext()
{
DbPath = Path.Join(AppDomain.CurrentDomain.BaseDirectory, "MikrotikWireguard.db");
}
protected override void OnConfiguring(DbContextOptionsBuilder options)
=> options.UseSqlite($"Data Source={DbPath}");
}
}