index for GanjoorPostId in narrations
This commit is contained in:
parent
bf4e36cacc
commit
c8a55d6a82
@ -71,6 +71,9 @@ namespace RMuseum.DbContext
|
||||
builder.Entity<RTagValue>()
|
||||
.HasIndex(t => t.FriendlyUrl);
|
||||
|
||||
builder.Entity<PoemNarration>()
|
||||
.HasIndex(p => p.GanjoorPostId);
|
||||
|
||||
builder.Entity<GanjoorCat>()
|
||||
.HasIndex(c => c.FullUrl);
|
||||
|
||||
|
||||
1553
RMuseum/Migrations/20201025094846_GanjoorPostIdIndex.Designer.cs
generated
Normal file
1553
RMuseum/Migrations/20201025094846_GanjoorPostIdIndex.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
22
RMuseum/Migrations/20201025094846_GanjoorPostIdIndex.cs
Normal file
22
RMuseum/Migrations/20201025094846_GanjoorPostIdIndex.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace RMuseum.Migrations
|
||||
{
|
||||
public partial class GanjoorPostIdIndex : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AudioFiles_GanjoorPostId",
|
||||
table: "AudioFiles",
|
||||
column: "GanjoorPostId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_AudioFiles_GanjoorPostId",
|
||||
table: "AudioFiles");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -340,7 +340,7 @@ namespace RMuseum.Migrations
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("int");
|
||||
|
||||
|
||||
b.Property<string>("FullUrl")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
@ -371,7 +371,7 @@ namespace RMuseum.Migrations
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("int");
|
||||
|
||||
|
||||
b.Property<int>("CatId")
|
||||
.HasColumnType("int");
|
||||
|
||||
@ -515,6 +515,8 @@ namespace RMuseum.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GanjoorPostId");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.HasIndex("ReviewerId");
|
||||
|
||||
@ -14,6 +14,7 @@ namespace RMuseum.Models.GanjoorAudio.ViewModels
|
||||
/// constructor
|
||||
/// </summary>
|
||||
/// <param name="src"></param>
|
||||
/// <param name="poem"></param>
|
||||
public PoemNarrationViewModel(PoemNarration src, GanjoorPoem poem)
|
||||
{
|
||||
Id = src.Id;
|
||||
|
||||
@ -2051,6 +2051,7 @@
|
||||
constructor
|
||||
</summary>
|
||||
<param name="src"></param>
|
||||
<param name="poem"></param>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.GanjoorAudio.ViewModels.PoemNarrationViewModel.Id">
|
||||
<summary>
|
||||
|
||||
@ -39,7 +39,7 @@ namespace RMuseum.Services.Implementation
|
||||
try
|
||||
{
|
||||
var source =
|
||||
from audio in _context.AudioFiles
|
||||
_context.AudioFiles
|
||||
.Include(a => a.Owner)
|
||||
.Where(a =>
|
||||
(filteredUserId == Guid.Empty || a.OwnerId == filteredUserId)
|
||||
@ -47,9 +47,12 @@ namespace RMuseum.Services.Implementation
|
||||
(status == AudioReviewStatus.All || a.ReviewStatus == status)
|
||||
)
|
||||
.OrderByDescending(a => a.UploadDate)
|
||||
join poem in _context.GanjoorPoems
|
||||
on audio.GanjoorPostId equals poem.Id
|
||||
select new PoemNarrationViewModel(audio, poem);
|
||||
.Join(
|
||||
_context.GanjoorPoems,
|
||||
audio => audio.GanjoorPostId,
|
||||
poem => poem.Id,
|
||||
(audio, poem) => new PoemNarrationViewModel(audio, poem)
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user