1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Materialize before returning data from GetAll calls

This commit is contained in:
Robert 2024-03-11 20:37:36 +01:00
parent ff0ad99b4a
commit 1196a95336
4 changed files with 5 additions and 6 deletions

View File

@ -31,7 +31,7 @@ internal class DeviceRepository(Func<ArtemisDbContext> getContext) : IDeviceRepo
public IEnumerable<DeviceEntity> GetAll()
{
using ArtemisDbContext dbContext = getContext();
return dbContext.Devices;
return dbContext.Devices.AsEnumerable();
}
public void Save(DeviceEntity deviceEntity)

View File

@ -37,7 +37,7 @@ internal class EntryRepository(Func<ArtemisDbContext> getContext) : IEntryReposi
public IEnumerable<EntryEntity> GetAll()
{
using ArtemisDbContext dbContext = getContext();
return dbContext.Entries;
return dbContext.Entries.AsEnumerable();
}
public void Save(EntryEntity entryEntity)

View File

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using Artemis.Storage.Entities.Profile;
namespace Artemis.Storage.Repositories.Interfaces;
@ -9,7 +8,7 @@ public interface IProfileCategoryRepository : IRepository
{
void Add(ProfileCategoryEntity profileCategoryEntity);
void Remove(ProfileCategoryEntity profileCategoryEntity);
List<ProfileCategoryEntity> GetAll();
IEnumerable<ProfileCategoryEntity> GetAll();
ProfileCategoryEntity? Get(Guid id);
bool IsUnique(string name, Guid? id);
void Save(ProfileCategoryEntity profileCategoryEntity);

View File

@ -25,7 +25,7 @@ internal class ProfileCategoryRepository(Func<ArtemisDbContext> getContext, IPro
dbContext.SaveChanges();
}
public List<ProfileCategoryEntity> GetAll()
public IEnumerable<ProfileCategoryEntity> GetAll()
{
if (!_migratedProfiles)
{
@ -34,7 +34,7 @@ internal class ProfileCategoryRepository(Func<ArtemisDbContext> getContext, IPro
}
using ArtemisDbContext dbContext = getContext();
return dbContext.ProfileCategories.Include(c => c.ProfileConfigurations).ToList();
return dbContext.ProfileCategories.Include(c => c.ProfileConfigurations).AsEnumerable();
}
public ProfileCategoryEntity? Get(Guid id)