techgarage-ir.MTWireGuard/Application/DBContext.cs

22 lines
555 B
C#
Raw Normal View History

2023-03-03 23:24:18 +03:30
using Microsoft.EntityFrameworkCore;
2023-06-02 15:26:29 +03:30
using MTWireGuard.Application.Models.Mikrotik;
2023-03-03 23:24:18 +03:30
2023-06-02 15:26:29 +03:30
namespace MTWireGuard.Application
2023-03-03 23:24:18 +03:30
{
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}");
}
}