mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Fix SQLite
This commit is contained in:
1 parent
ac577e87cc
commit
3accdf0af0
6 files changed
+43
-2
No files matched your search
@@ -14,6 +14,7 @@ namespace Artemis.Storage.Repositories
|
||||
public ProfileRepository()
|
||||
{
|
||||
_dbContext = new StorageContext();
|
||||
_dbContext.Database.EnsureCreated();
|
||||
}
|
||||
|
||||
public IQueryable<ProfileEntity> GetAll()
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace Artemis.Storage.Repositories
|
||||
internal SettingRepository()
|
||||
{
|
||||
_dbContext = new StorageContext();
|
||||
_dbContext.Database.EnsureCreated();
|
||||
}
|
||||
|
||||
public IQueryable<SettingEntity> GetAll()
|
||||
|
||||
Binary file not shown.
@@ -1,4 +1,7 @@
|
||||
using Artemis.Storage.Entities;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using Artemis.Storage.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Artemis.Storage
|
||||
@@ -10,7 +13,14 @@ namespace Artemis.Storage
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
optionsBuilder.UseSqlite("Data Source=Storage.db");
|
||||
#if DEBUG
|
||||
var dbLocation = Path.GetFullPath(Path.Combine(Assembly.GetEntryAssembly().Location, @"..\..\..\..\Artemis.Storage\Storage.db"));
|
||||
#else
|
||||
var dbLocation = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Artemis\\Storage.db";
|
||||
#endif
|
||||
optionsBuilder.UseSqlite("Data Source=" + dbLocation);
|
||||
|
||||
// Requires Microsoft.Data.Sqlite in the startup project
|
||||
SQLitePCL.Batteries.Init();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user