using Bunny.Dao.Entity.Blog; using Microsoft.EntityFrameworkCore; namespace Bunny.Common.EFCore; public class EfCoreContext : DbContext { public EfCoreContext() { // var dbPath = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "bunny.db"); // DbPath = Path.Join(dbPath, "bunny.db"); // DbPath = @"D:\Project\web\Bunny-Cli\template\CSharp\CSharp-Single-EFCore\Bunny.WebApi\bunny.db"; var dataBaseConnection = AppSettings.GetAppConfig("DataBase:DataBaseConnection"); DbPath = dataBaseConnection; } public DbSet Blogs { get; set; } public DbSet Posts { get; set; } public string DbPath { get; } protected override void OnConfiguring(DbContextOptionsBuilder options) { options.UseSqlite($"Data Source={DbPath}"); } }