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, tested this time

This commit is contained in:
Robert 2024-03-12 08:43:20 +01:00
parent 1196a95336
commit f66df43cc2
6 changed files with 9 additions and 9 deletions

View File

@ -28,10 +28,10 @@ internal class DeviceRepository(Func<ArtemisDbContext> getContext) : IDeviceRepo
return dbContext.Devices.FirstOrDefault(d => d.Id == id);
}
public IEnumerable<DeviceEntity> GetAll()
public List<DeviceEntity> GetAll()
{
using ArtemisDbContext dbContext = getContext();
return dbContext.Devices.AsEnumerable();
return dbContext.Devices.ToList();
}
public void Save(DeviceEntity deviceEntity)

View File

@ -34,10 +34,10 @@ internal class EntryRepository(Func<ArtemisDbContext> getContext) : IEntryReposi
return dbContext.Entries.FirstOrDefault(s => s.EntryId == entryId);
}
public IEnumerable<EntryEntity> GetAll()
public List<EntryEntity> GetAll()
{
using ArtemisDbContext dbContext = getContext();
return dbContext.Entries.AsEnumerable();
return dbContext.Entries.ToList();
}
public void Save(EntryEntity entryEntity)

View File

@ -8,7 +8,7 @@ public interface IDeviceRepository : IRepository
void Add(DeviceEntity deviceEntity);
void Remove(DeviceEntity deviceEntity);
DeviceEntity? Get(string id);
IEnumerable<DeviceEntity> GetAll();
List<DeviceEntity> GetAll();
void Save(DeviceEntity deviceEntity);
void SaveRange(IEnumerable<DeviceEntity> deviceEntities);
}

View File

@ -10,6 +10,6 @@ public interface IEntryRepository : IRepository
void Remove(EntryEntity entryEntity);
EntryEntity? Get(Guid id);
EntryEntity? GetByEntryId(long entryId);
IEnumerable<EntryEntity> GetAll();
List<EntryEntity> GetAll();
void Save(EntryEntity entryEntity);
}

View File

@ -8,7 +8,7 @@ public interface IProfileCategoryRepository : IRepository
{
void Add(ProfileCategoryEntity profileCategoryEntity);
void Remove(ProfileCategoryEntity profileCategoryEntity);
IEnumerable<ProfileCategoryEntity> GetAll();
List<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 IEnumerable<ProfileCategoryEntity> GetAll()
public List<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).AsEnumerable();
return dbContext.ProfileCategories.Include(c => c.ProfileConfigurations).ToList();
}
public ProfileCategoryEntity? Get(Guid id)