Я делаю приложение, которое использует sqlite в качестве localdb.
Я хочу сохранить базу данных в файле appdata пользователя.
Вот мой код:
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace cctv_tech.Models
{
class DatabaseContext : DbContext
{
public DbSet<Setting> Settings { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite("Data Source=mydb.db;");
// this is working, but database file is within the debug folder
optionsBuilder.UseSqlite("Data Source=c:\\mydb.db;");
// this output me an error which the database cannot be open,
// and when checked there is no such file
}
}
}

Надеюсь, кто-нибудь может помочь. Большое спасибо.