Skip to content

Commit

Permalink
Materialize before returning data from GetAll calls, tested this time
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertBeekman committed Mar 12, 2024
1 parent 1196a95 commit f66df43
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Artemis.Storage/Repositories/DeviceRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ public void Remove(DeviceEntity deviceEntity)
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)
Expand Down
4 changes: 2 additions & 2 deletions src/Artemis.Storage/Repositories/EntryRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public void Remove(EntryEntity entryEntity)
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/Artemis.Storage/Repositories/ProfileCategoryRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void Remove(ProfileCategoryEntity profileCategoryEntity)
dbContext.SaveChanges();
}

public IEnumerable<ProfileCategoryEntity> GetAll()
public List<ProfileCategoryEntity> GetAll()
{
if (!_migratedProfiles)
{
Expand All @@ -34,7 +34,7 @@ public IEnumerable<ProfileCategoryEntity> GetAll()
}

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)
Expand Down

0 comments on commit f66df43

Please sign in to comment.