mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Added most of the settings code, doesn't work because SQLite is weird
This commit is contained in:
1 parent
40c3222ae9
commit
8f4bb37fa4
42 files changed
+409
-582
No files matched your search
@@ -0,0 +1,6 @@
|
||||
namespace Artemis.Storage.Repositories
|
||||
{
|
||||
public interface IRepository
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Storage.Entities;
|
||||
|
||||
namespace Artemis.Storage.Repositories
|
||||
{
|
||||
public interface ISettingRepository : IRepository
|
||||
{
|
||||
IQueryable<SettingEntity> GetAll();
|
||||
List<SettingEntity> GetByPluginGuid(Guid pluginGuid);
|
||||
void Add(SettingEntity settingEntity);
|
||||
Task<List<SettingEntity>> GetByPluginGuidAsync(Guid pluginGuid);
|
||||
Task<SettingEntity> GetByNameAndPluginGuid(string name, Guid pluginGuid);
|
||||
Task<SettingEntity> GetByName(string name);
|
||||
void Save();
|
||||
Task SaveAsync();
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,11 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Artemis.Storage.Repositories
|
||||
{
|
||||
public class SettingRepository
|
||||
public class SettingRepository : ISettingRepository
|
||||
{
|
||||
private readonly StorageContext _dbContext;
|
||||
|
||||
public SettingRepository()
|
||||
internal SettingRepository()
|
||||
{
|
||||
_dbContext = new StorageContext();
|
||||
}
|
||||
@@ -26,6 +26,11 @@ namespace Artemis.Storage.Repositories
|
||||
return _dbContext.Settings.Where(p => p.PluginGuid == pluginGuid).ToList();
|
||||
}
|
||||
|
||||
public void Add(SettingEntity settingEntity)
|
||||
{
|
||||
_dbContext.Settings.Add(settingEntity);
|
||||
}
|
||||
|
||||
public async Task<List<SettingEntity>> GetByPluginGuidAsync(Guid pluginGuid)
|
||||
{
|
||||
return await _dbContext.Settings.Where(p => p.PluginGuid == pluginGuid).ToListAsync();
|
||||
|
||||
Reference in new issue
Block a user