mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Use lazy loading proxies.
This commit is contained in:
@@ -16,7 +16,7 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
|
||||
|
||||
// GET: Admin/DeviceStats
|
||||
public async Task<IActionResult> Index() =>
|
||||
View(await _context.DeviceStats.Include(d => d.Report).OrderBy(d => d.Manufacturer).ThenBy(d => d.Model).
|
||||
View(await _context.DeviceStats.OrderBy(d => d.Manufacturer).ThenBy(d => d.Model).
|
||||
ThenBy(d => d.Bus).ToListAsync());
|
||||
|
||||
// GET: Admin/DeviceStats/Edit/5
|
||||
|
||||
@@ -31,12 +31,7 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
|
||||
|
||||
var model = new DeviceDetails
|
||||
{
|
||||
Report = await _context.Devices.Include(d => d.ATA).Include(d => d.ATA.ReadCapabilities).
|
||||
Include(d => d.ATAPI).Include(d => d.SCSI).
|
||||
Include(d => d.SCSI.MultiMediaDevice).Include(d => d.SCSI.ReadCapabilities).
|
||||
Include(d => d.SCSI.SequentialDevice).Include(d => d.MultiMediaCard).
|
||||
Include(d => d.SecureDigital).Include(d => d.USB).Include(d => d.FireWire).
|
||||
Include(d => d.PCMCIA).FirstOrDefaultAsync(m => m.Id == id)
|
||||
Report = await _context.Devices.FirstOrDefaultAsync(m => m.Id == id)
|
||||
};
|
||||
|
||||
if(model.Report is null)
|
||||
@@ -66,13 +61,13 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
|
||||
d.Revision == model.Report.Revision && d.Id != id).
|
||||
Select(d => d.Id).Where(d => model.SameAll.All(r => r != d)).ToList();
|
||||
|
||||
model.StatsAll = _context.DeviceStats.Include(d => d.Report).
|
||||
model.StatsAll = _context.DeviceStats.
|
||||
Where(d => d.Manufacturer == model.Report.Manufacturer &&
|
||||
d.Model == model.Report.Model &&
|
||||
d.Revision == model.Report.Revision &&
|
||||
d.Report.Id != model.Report.Id).ToList();
|
||||
|
||||
model.StatsButManufacturer = _context.DeviceStats.Include(d => d.Report).
|
||||
model.StatsButManufacturer = _context.DeviceStats.
|
||||
Where(d => d.Model == model.Report.Model &&
|
||||
d.Revision == model.Report.Revision &&
|
||||
d.Report.Id != model.Report.Id).AsEnumerable().
|
||||
|
||||
@@ -31,12 +31,7 @@ namespace DiscImageChef.Server.Areas.Admin.Controllers
|
||||
|
||||
var model = new UploadedReportDetails
|
||||
{
|
||||
Report = await _context.Reports.Include(d => d.ATA).Include(d => d.ATA.ReadCapabilities).
|
||||
Include(d => d.ATAPI).Include(d => d.SCSI).
|
||||
Include(d => d.SCSI.MultiMediaDevice).Include(d => d.SCSI.ReadCapabilities).
|
||||
Include(d => d.SCSI.SequentialDevice).Include(d => d.MultiMediaCard).
|
||||
Include(d => d.SecureDigital).Include(d => d.USB).Include(d => d.FireWire).
|
||||
Include(d => d.PCMCIA).FirstOrDefaultAsync(m => m.Id == id)
|
||||
Report = await _context.Reports.FirstOrDefaultAsync(m => m.Id == id)
|
||||
};
|
||||
|
||||
if(model.Report is null)
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace DiscImageChef.Server.Models
|
||||
|
||||
IConfigurationBuilder builder = new ConfigurationBuilder().AddJsonFile("appsettings.json");
|
||||
IConfigurationRoot configuration = builder.Build();
|
||||
optionsBuilder.UseMySql(configuration.GetConnectionString("DefaultConnection"));
|
||||
optionsBuilder.UseMySql(configuration.GetConnectionString("DefaultConnection")).UseLazyLoadingProxies();
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace DiscImageChef.Server
|
||||
{
|
||||
services.AddDbContext<DicServerContext>(options =>
|
||||
options.UseMySql(Configuration.
|
||||
GetConnectionString("DefaultConnection")));
|
||||
GetConnectionString("DefaultConnection")).UseLazyLoadingProxies());
|
||||
|
||||
services.AddDefaultIdentity<IdentityUser>(options =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user