mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Use lazy loading of related tables.
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="2.1.1" />
|
||||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.1.1" />
|
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.1.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
1721
Cicm.Database/Migrations/20180806222713_LogosGuid.Designer.cs
generated
Normal file
1721
Cicm.Database/Migrations/20180806222713_LogosGuid.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
11
Cicm.Database/Migrations/20180806222713_LogosGuid.cs
Normal file
11
Cicm.Database/Migrations/20180806222713_LogosGuid.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
namespace Cicm.Database.Migrations
|
||||||
|
{
|
||||||
|
public partial class LogosGuid : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder) { }
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -31,15 +31,15 @@ namespace Cicm.Database.Models
|
|||||||
public short? CountryId { get; set; }
|
public short? CountryId { get; set; }
|
||||||
public CompanyStatus Status { get; set; }
|
public CompanyStatus Status { get; set; }
|
||||||
|
|
||||||
public Iso31661Numeric Country { get; set; }
|
public virtual Iso31661Numeric Country { get; set; }
|
||||||
public Company SoldTo { get; set; }
|
public virtual Company SoldTo { get; set; }
|
||||||
public CompanyDescription Description { get; set; }
|
public virtual CompanyDescription Description { get; set; }
|
||||||
public ICollection<CompanyLogo> CompanyLogos { get; set; }
|
public virtual ICollection<CompanyLogo> CompanyLogos { get; set; }
|
||||||
public ICollection<Gpu> Gpus { get; set; }
|
public virtual ICollection<Gpu> Gpus { get; set; }
|
||||||
public ICollection<Company> InverseSoldToNavigation { get; set; }
|
public virtual ICollection<Company> InverseSoldToNavigation { get; set; }
|
||||||
public ICollection<MachineFamily> MachineFamilies { get; set; }
|
public virtual ICollection<MachineFamily> MachineFamilies { get; set; }
|
||||||
public ICollection<Machine> Machines { get; set; }
|
public virtual ICollection<Machine> Machines { get; set; }
|
||||||
public ICollection<Processor> Processors { get; set; }
|
public virtual ICollection<Processor> Processors { get; set; }
|
||||||
public ICollection<SoundSynth> SoundSynths { get; set; }
|
public virtual ICollection<SoundSynth> SoundSynths { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,6 @@
|
|||||||
public int CompanyId { get; set; }
|
public int CompanyId { get; set; }
|
||||||
public string Text { get; set; }
|
public string Text { get; set; }
|
||||||
|
|
||||||
public Company Company { get; set; }
|
public virtual Company Company { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
namespace Cicm.Database.Models
|
using System;
|
||||||
|
|
||||||
|
namespace Cicm.Database.Models
|
||||||
{
|
{
|
||||||
public class CompanyLogo
|
public class CompanyLogo
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int CompanyId { get; set; }
|
public int CompanyId { get; set; }
|
||||||
public int? Year { get; set; }
|
public int? Year { get; set; }
|
||||||
public string Guid { get; set; }
|
public Guid Guid { get; set; }
|
||||||
|
|
||||||
public Company Company { get; set; }
|
public virtual Company Company { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,8 +22,8 @@ namespace Cicm.Database.Models
|
|||||||
public float? DieSize { get; set; }
|
public float? DieSize { get; set; }
|
||||||
public long? Transistors { get; set; }
|
public long? Transistors { get; set; }
|
||||||
|
|
||||||
public Company Company { get; set; }
|
public virtual Company Company { get; set; }
|
||||||
public ICollection<GpusByMachine> GpusByMachine { get; set; }
|
public virtual ICollection<GpusByMachine> GpusByMachine { get; set; }
|
||||||
public ICollection<ResolutionsByGpu> ResolutionsByGpu { get; set; }
|
public virtual ICollection<ResolutionsByGpu> ResolutionsByGpu { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
public int MachineId { get; set; }
|
public int MachineId { get; set; }
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
|
|
||||||
public Gpu Gpu { get; set; }
|
public virtual Gpu Gpu { get; set; }
|
||||||
public Machine Machine { get; set; }
|
public virtual Machine Machine { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,6 +12,6 @@ namespace Cicm.Database.Models
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
public ICollection<Processor> Processors { get; set; }
|
public virtual ICollection<Processor> Processors { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,6 +12,10 @@ namespace Cicm.Database.Models
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string Extension { get; set; }
|
public string Extension { get; set; }
|
||||||
|
|
||||||
public ICollection<InstructionSetExtensionsByProcessor> InstructionSetExtensionsByProcessor { get; set; }
|
public virtual ICollection<InstructionSetExtensionsByProcessor> InstructionSetExtensionsByProcessor
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
public int ProcessorId { get; set; }
|
public int ProcessorId { get; set; }
|
||||||
public int ExtensionId { get; set; }
|
public int ExtensionId { get; set; }
|
||||||
|
|
||||||
public InstructionSetExtension Extension { get; set; }
|
public virtual InstructionSetExtension Extension { get; set; }
|
||||||
public Processor Processor { get; set; }
|
public virtual Processor Processor { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,6 +12,6 @@ namespace Cicm.Database.Models
|
|||||||
public short Id { get; set; }
|
public short Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
public ICollection<Company> Companies { get; set; }
|
public virtual ICollection<Company> Companies { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,12 +22,12 @@ namespace Cicm.Database.Models
|
|||||||
public int? FamilyId { get; set; }
|
public int? FamilyId { get; set; }
|
||||||
public string Model { get; set; }
|
public string Model { get; set; }
|
||||||
|
|
||||||
public Company Company { get; set; }
|
public virtual Company Company { get; set; }
|
||||||
public MachineFamily Family { get; set; }
|
public virtual MachineFamily Family { get; set; }
|
||||||
public ICollection<GpusByMachine> Gpus { get; set; }
|
public virtual ICollection<GpusByMachine> Gpus { get; set; }
|
||||||
public ICollection<MemoryByMachine> Memory { get; set; }
|
public virtual ICollection<MemoryByMachine> Memory { get; set; }
|
||||||
public ICollection<ProcessorsByMachine> Processors { get; set; }
|
public virtual ICollection<ProcessorsByMachine> Processors { get; set; }
|
||||||
public ICollection<SoundByMachine> Sound { get; set; }
|
public virtual ICollection<SoundByMachine> Sound { get; set; }
|
||||||
public ICollection<StorageByMachine> Storage { get; set; }
|
public virtual ICollection<StorageByMachine> Storage { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -13,7 +13,7 @@ namespace Cicm.Database.Models
|
|||||||
public int CompanyId { get; set; }
|
public int CompanyId { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
public Company Company { get; set; }
|
public virtual Company Company { get; set; }
|
||||||
public ICollection<Machine> Machines { get; set; }
|
public virtual ICollection<Machine> Machines { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,6 +9,6 @@
|
|||||||
public double? Speed { get; set; }
|
public double? Speed { get; set; }
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
|
|
||||||
public Machine Machine { get; set; }
|
public virtual Machine Machine { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -38,9 +38,9 @@ namespace Cicm.Database.Models
|
|||||||
public float? L2 { get; set; }
|
public float? L2 { get; set; }
|
||||||
public float? L3 { get; set; }
|
public float? L3 { get; set; }
|
||||||
|
|
||||||
public Company Company { get; set; }
|
public virtual Company Company { get; set; }
|
||||||
public InstructionSet InstructionSet { get; set; }
|
public virtual InstructionSet InstructionSet { get; set; }
|
||||||
public ICollection<InstructionSetExtensionsByProcessor> InstructionSetExtensions { get; set; }
|
public virtual ICollection<InstructionSetExtensionsByProcessor> InstructionSetExtensions { get; set; }
|
||||||
public ICollection<ProcessorsByMachine> ProcessorsByMachine { get; set; }
|
public virtual ICollection<ProcessorsByMachine> ProcessorsByMachine { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
public float? Speed { get; set; }
|
public float? Speed { get; set; }
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
|
|
||||||
public Machine Machine { get; set; }
|
public virtual Machine Machine { get; set; }
|
||||||
public Processor Processor { get; set; }
|
public virtual Processor Processor { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,6 +16,6 @@ namespace Cicm.Database.Models
|
|||||||
public long? Palette { get; set; }
|
public long? Palette { get; set; }
|
||||||
public sbyte Chars { get; set; }
|
public sbyte Chars { get; set; }
|
||||||
|
|
||||||
public ICollection<ResolutionsByGpu> ResolutionsByGpu { get; set; }
|
public virtual ICollection<ResolutionsByGpu> ResolutionsByGpu { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
public int ResolutionId { get; set; }
|
public int ResolutionId { get; set; }
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
|
|
||||||
public Gpu Gpu { get; set; }
|
public virtual Gpu Gpu { get; set; }
|
||||||
public Resolution Resolution { get; set; }
|
public virtual Resolution Resolution { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
public int MachineId { get; set; }
|
public int MachineId { get; set; }
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
|
|
||||||
public Machine Machine { get; set; }
|
public virtual Machine Machine { get; set; }
|
||||||
public SoundSynth SoundSynth { get; set; }
|
public virtual SoundSynth SoundSynth { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,7 +22,7 @@ namespace Cicm.Database.Models
|
|||||||
public int? WhiteNoise { get; set; }
|
public int? WhiteNoise { get; set; }
|
||||||
public int? Type { get; set; }
|
public int? Type { get; set; }
|
||||||
|
|
||||||
public Company Company { get; set; }
|
public virtual Company Company { get; set; }
|
||||||
public ICollection<SoundByMachine> SoundByMachine { get; set; }
|
public virtual ICollection<SoundByMachine> SoundByMachine { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,6 @@
|
|||||||
public long? Capacity { get; set; }
|
public long? Capacity { get; set; }
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
|
|
||||||
public Machine Machine { get; set; }
|
public virtual Machine Machine { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,6 +43,7 @@ namespace Cicm.Database.Models
|
|||||||
{
|
{
|
||||||
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
|
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
|
||||||
optionsBuilder.UseMySql("server=localhost;port=3306;user=cicm;password=cicmpass;database=cicm");
|
optionsBuilder.UseMySql("server=localhost;port=3306;user=cicm;password=cicmpass;database=cicm");
|
||||||
|
optionsBuilder.UseLazyLoadingProxies();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,8 +65,7 @@ namespace cicm_web.Controllers
|
|||||||
public IActionResult View(int id)
|
public IActionResult View(int id)
|
||||||
{
|
{
|
||||||
ViewBag.WebRootPath = hostingEnvironment.WebRootPath;
|
ViewBag.WebRootPath = hostingEnvironment.WebRootPath;
|
||||||
Company company = _context.Companies.Where(c => c.Id == id).Include(c => c.Description)
|
Company company = _context.Companies.FirstOrDefault(c => c.Id == id);
|
||||||
.Include(c => c.Machines).Include(c => c.Country).FirstOrDefault();
|
|
||||||
|
|
||||||
if(company == null) return Index();
|
if(company == null) return Index();
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ using Cicm.Database;
|
|||||||
using Cicm.Database.Models;
|
using Cicm.Database.Models;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace cicm_web.Controllers
|
namespace cicm_web.Controllers
|
||||||
{
|
{
|
||||||
@@ -73,19 +72,18 @@ namespace cicm_web.Controllers
|
|||||||
ViewBag.Letter = id;
|
ViewBag.Letter = id;
|
||||||
|
|
||||||
return View(id == '\0'
|
return View(id == '\0'
|
||||||
? _context.Machines.Include(c => c.Company).Where(m => m.Type == MachineType.Computer)
|
? _context.Machines.Where(m => m.Type == MachineType.Computer).ToArray()
|
||||||
.ToArray()
|
: _context.Machines.Where(m => m.Type == MachineType.Computer && m.Name.StartsWith(id))
|
||||||
: _context.Machines.Include(c => c.Company)
|
.ToArray());
|
||||||
.Where(m => m.Type == MachineType.Computer && m.Name.StartsWith(id)).ToArray());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult ByYear(int id)
|
public IActionResult ByYear(int id)
|
||||||
{
|
{
|
||||||
ViewBag.Year = id;
|
ViewBag.Year = id;
|
||||||
|
|
||||||
return View(_context.Machines.Include(c => c.Company)
|
return View(_context.Machines.Where(t => t.Type == MachineType.Computer &&
|
||||||
.Where(t => t.Type == MachineType.Computer && t.Introduced.HasValue &&
|
t.Introduced.HasValue &&
|
||||||
t.Introduced.Value.Year == id).ToArray());
|
t.Introduced.Value.Year == id).ToArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,6 @@ using Cicm.Database;
|
|||||||
using Cicm.Database.Models;
|
using Cicm.Database.Models;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace cicm_web.Controllers
|
namespace cicm_web.Controllers
|
||||||
{
|
{
|
||||||
@@ -73,19 +72,18 @@ namespace cicm_web.Controllers
|
|||||||
ViewBag.Letter = id;
|
ViewBag.Letter = id;
|
||||||
|
|
||||||
return View(id == '\0'
|
return View(id == '\0'
|
||||||
? _context.Machines.Include(c => c.Company).Where(m => m.Type == MachineType.Console)
|
? _context.Machines.Where(m => m.Type == MachineType.Console).ToArray()
|
||||||
.ToArray()
|
: _context.Machines.Where(m => m.Type == MachineType.Console && m.Name.StartsWith(id))
|
||||||
: _context.Machines.Include(c => c.Company)
|
.ToArray());
|
||||||
.Where(m => m.Type == MachineType.Console && m.Name.StartsWith(id)).ToArray());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult ByYear(int id)
|
public IActionResult ByYear(int id)
|
||||||
{
|
{
|
||||||
ViewBag.Year = id;
|
ViewBag.Year = id;
|
||||||
|
|
||||||
return View(_context.Machines.Include(c => c.Company)
|
return View(_context.Machines.Where(t => t.Type == MachineType.Console &&
|
||||||
.Where(t => t.Type == MachineType.Console && t.Introduced.HasValue &&
|
t.Introduced.HasValue &&
|
||||||
t.Introduced.Value.Year == id).ToArray());
|
t.Introduced.Value.Year == id).ToArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,9 +53,9 @@ namespace cicm_web
|
|||||||
services.AddMvc();
|
services.AddMvc();
|
||||||
|
|
||||||
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
|
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
|
||||||
services.AddDbContext<cicmContext>(options =>
|
services.AddDbContext<cicmContext>(options => options
|
||||||
options
|
.UseLazyLoadingProxies()
|
||||||
.UseMySql("server=localhost;port=3306;user=cicm;password=cicmpass;database=cicm"));
|
.UseMySql("server=localhost;port=3306;user=cicm;password=cicmpass;database=cicm"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
<Version>3.0.99.292</Version>
|
<Version>3.0.99.301</Version>
|
||||||
<Company>Canary Islands Computer Museum</Company>
|
<Company>Canary Islands Computer Museum</Company>
|
||||||
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
||||||
<Product>Canary Islands Computer Museum Website</Product>
|
<Product>Canary Islands Computer Museum Website</Product>
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Markdig" Version="0.15.0" />
|
<PackageReference Include="Markdig" Version="0.15.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" />
|
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.6" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="2.1.1" />
|
||||||
<PackageReference Include="Microsoft.NETCore.App" Version="2.0.6" />
|
<PackageReference Include="Microsoft.NETCore.App" Version="2.0.6" />
|
||||||
<PackageReference Include="MSBump" Version="2.3.2" PrivateAssets="All" />
|
<PackageReference Include="MSBump" Version="2.3.2" PrivateAssets="All" />
|
||||||
<PackageReference Include="MySql.Data" Version="6.10.6" />
|
<PackageReference Include="MySql.Data" Version="6.10.6" />
|
||||||
|
|||||||
Reference in New Issue
Block a user