Add lazy loading
parent
024eec1b50
commit
6a5afaad5d
|
@ -12,11 +12,8 @@ namespace LANCommander.Data.Models
|
|||
[Required]
|
||||
public string Version { get; set; }
|
||||
|
||||
public Game Game { get; set; }
|
||||
public virtual Game Game { get; set; }
|
||||
|
||||
public Archive? LastVersion { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public IFormFile UploadedFile { get; set; }
|
||||
public virtual Archive? LastVersion { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public ICollection<Game> PublishedGames { get; set; }
|
||||
public ICollection<Game> DevelopedGames { get; set; }
|
||||
public virtual ICollection<Game> PublishedGames { get; set; }
|
||||
public virtual ICollection<Game> DevelopedGames { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,11 +12,11 @@ namespace LANCommander.Data.Models
|
|||
public string Description { get; set; }
|
||||
public DateTime ReleasedOn { get; set; }
|
||||
|
||||
public ICollection<Tag>? Tags { get; set; }
|
||||
public virtual ICollection<Tag>? Tags { get; set; }
|
||||
|
||||
public Company? Publisher { get; set; }
|
||||
public Company? Developer { get; set; }
|
||||
public virtual Company? Publisher { get; set; }
|
||||
public virtual Company? Developer { get; set; }
|
||||
|
||||
public ICollection<Archive>? Archives { get; set; }
|
||||
public virtual ICollection<Archive>? Archives { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,6 @@ namespace LANCommander.Data.Models
|
|||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public List<Game> Games { get; set; }
|
||||
public virtual List<Game> Games { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.8" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.8" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="6.0.8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.8">
|
||||
|
|
|
@ -7,8 +7,12 @@ var builder = WebApplication.CreateBuilder(args);
|
|||
|
||||
// Add services to the container.
|
||||
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
|
||||
builder.Services.AddDbContext<global::LANCommander.Data.DatabaseContext>((global::Microsoft.EntityFrameworkCore.DbContextOptionsBuilder options) =>
|
||||
options.UseSqlite(connectionString));
|
||||
|
||||
builder.Services.AddDbContext<LANCommander.Data.DatabaseContext>(b =>
|
||||
{
|
||||
b.UseLazyLoadingProxies();
|
||||
b.UseSqlite(connectionString);
|
||||
});
|
||||
|
||||
builder.Services.AddDatabaseDeveloperPageExceptionFilter();
|
||||
|
||||
|
|
Loading…
Reference in New Issue