#241 adding PoetId to GanjoorCachedRelatedPoem and changing index on the table
This commit is contained in:
parent
fb284ebaea
commit
739f9f96de
@ -137,7 +137,7 @@ namespace RMuseum.DbContext
|
||||
.HasIndex(v => new { v.PoemId, v.CoupletIndex });
|
||||
|
||||
builder.Entity<GanjoorCachedRelatedPoem>()
|
||||
.HasIndex(c => new { c.PoemId, c.RelationOrder });
|
||||
.HasIndex(c => new { c.PoemId });
|
||||
|
||||
//Index set suggested by SQL Server Tuning Wizard -- end
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@ using RMuseum.DbContext;
|
||||
namespace RMuseum.Migrations
|
||||
{
|
||||
[DbContext(typeof(RMuseumDbContext))]
|
||||
[Migration("20211114151203_GanjoorCachedRelatedPoems")]
|
||||
[Migration("20211116160621_GanjoorCachedRelatedPoems")]
|
||||
partial class GanjoorCachedRelatedPoems
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@ -452,6 +452,9 @@ namespace RMuseum.Migrations
|
||||
b.Property<int>("PoemId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PoetId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PoetImageUrl")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
@ -466,7 +469,7 @@ namespace RMuseum.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PoemId", "RelationOrder");
|
||||
b.HasIndex("PoemId");
|
||||
|
||||
b.ToTable("GanjoorCachedRelatedPoems");
|
||||
});
|
||||
@ -13,6 +13,7 @@ namespace RMuseum.Migrations
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
PoemId = table.Column<int>(type: "int", nullable: false),
|
||||
PoetId = table.Column<int>(type: "int", nullable: false),
|
||||
RelationOrder = table.Column<int>(type: "int", nullable: false),
|
||||
PoetName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
PoetImageUrl = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
@ -33,9 +34,9 @@ namespace RMuseum.Migrations
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GanjoorCachedRelatedPoems_PoemId_RelationOrder",
|
||||
name: "IX_GanjoorCachedRelatedPoems_PoemId",
|
||||
table: "GanjoorCachedRelatedPoems",
|
||||
columns: new[] { "PoemId", "RelationOrder" });
|
||||
column: "PoemId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
@ -450,6 +450,9 @@ namespace RMuseum.Migrations
|
||||
b.Property<int>("PoemId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PoetId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PoetImageUrl")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
@ -464,7 +467,7 @@ namespace RMuseum.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PoemId", "RelationOrder");
|
||||
b.HasIndex("PoemId");
|
||||
|
||||
b.ToTable("GanjoorCachedRelatedPoems");
|
||||
});
|
||||
|
||||
@ -12,6 +12,11 @@
|
||||
/// </summary>
|
||||
public int PoemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// poet id
|
||||
/// </summary>
|
||||
public int PoetId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// poem
|
||||
/// </summary>
|
||||
|
||||
@ -4626,6 +4626,11 @@
|
||||
poem id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.Ganjoor.GanjoorCachedRelatedPoem.PoetId">
|
||||
<summary>
|
||||
poet id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.Ganjoor.GanjoorCachedRelatedPoem.Poem">
|
||||
<summary>
|
||||
poem
|
||||
|
||||
@ -76,6 +76,7 @@ namespace RMuseum.Services.Implementation
|
||||
GanjoorCachedRelatedPoem newRelatedPoem = new GanjoorCachedRelatedPoem()
|
||||
{
|
||||
PoemId = poemId,
|
||||
PoetId = relatedPoem.Cat.PoetId,
|
||||
RelationOrder = r,
|
||||
PoetName = relatedPoem.Cat.Poet.Nickname,
|
||||
PoetImageUrl = $"/api/ganjoor/poet/image{(await context.GanjoorCategories.Where(c => c.ParentId == null && c.PoetId == relatedPoem.Cat.PoetId).AsNoTracking().SingleAsync()).FullUrl}.gif",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user