mirror of
https://github.com/claunia/romrepomgr.git
synced 2025-12-16 19:24:51 +00:00
Load required relations.
This commit is contained in:
@@ -5,6 +5,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using RomRepoMgr.Database;
|
using RomRepoMgr.Database;
|
||||||
using RomRepoMgr.Database.Models;
|
using RomRepoMgr.Database.Models;
|
||||||
using SharpCompress.Compressors;
|
using SharpCompress.Compressors;
|
||||||
@@ -245,8 +246,8 @@ public class Vfs : IDisposable
|
|||||||
|
|
||||||
cachedMachineFiles = new ConcurrentDictionary<string, CachedFile>();
|
cachedMachineFiles = new ConcurrentDictionary<string, CachedFile>();
|
||||||
|
|
||||||
foreach(FileByMachine machineFile in
|
foreach(FileByMachine machineFile in ctx.FilesByMachines.Where(fbm => fbm.Machine.Id == id && fbm.File.IsInRepo)
|
||||||
ctx.FilesByMachines.Where(fbm => fbm.Machine.Id == id && fbm.File.IsInRepo))
|
.Include(fileByMachine => fileByMachine.File))
|
||||||
{
|
{
|
||||||
var cachedFile = new CachedFile
|
var cachedFile = new CachedFile
|
||||||
{
|
{
|
||||||
@@ -281,9 +282,11 @@ public class Vfs : IDisposable
|
|||||||
|
|
||||||
cachedMachineDisks = new ConcurrentDictionary<string, CachedDisk>();
|
cachedMachineDisks = new ConcurrentDictionary<string, CachedDisk>();
|
||||||
|
|
||||||
foreach(DiskByMachine machineDisk in ctx.DisksByMachines.Where(dbm => dbm.Machine.Id == id &&
|
foreach(DiskByMachine machineDisk in ctx.DisksByMachines
|
||||||
dbm.Disk.IsInRepo &&
|
.Where(dbm => dbm.Machine.Id == id &&
|
||||||
dbm.Disk.Size != null))
|
dbm.Disk.IsInRepo &&
|
||||||
|
dbm.Disk.Size != null)
|
||||||
|
.Include(diskByMachine => diskByMachine.Disk))
|
||||||
{
|
{
|
||||||
var cachedDisk = new CachedDisk
|
var cachedDisk = new CachedDisk
|
||||||
{
|
{
|
||||||
@@ -313,9 +316,11 @@ public class Vfs : IDisposable
|
|||||||
|
|
||||||
cachedMachineMedias = new ConcurrentDictionary<string, CachedMedia>();
|
cachedMachineMedias = new ConcurrentDictionary<string, CachedMedia>();
|
||||||
|
|
||||||
foreach(MediaByMachine machineMedia in ctx.MediasByMachines.Where(mbm => mbm.Machine.Id == id &&
|
foreach(MediaByMachine machineMedia in ctx.MediasByMachines
|
||||||
mbm.Media.IsInRepo &&
|
.Where(mbm => mbm.Machine.Id == id &&
|
||||||
mbm.Media.Size != null))
|
mbm.Media.IsInRepo &&
|
||||||
|
mbm.Media.Size != null)
|
||||||
|
.Include(mediaByMachine => mediaByMachine.Media))
|
||||||
{
|
{
|
||||||
var cachedDisk = new CachedMedia
|
var cachedDisk = new CachedMedia
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user