blob: 79262e4c8d3224bc8bb753ffea98827e857dcd51 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
using Jellyfin.Database.Implementations.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Jellyfin.Database.Implementations.ModelConfiguration;
/// <summary>
/// FluentAPI configuration for the BaseItemImageInfo entity.
/// </summary>
public class BaseItemImageInfoConfiguration : IEntityTypeConfiguration<BaseItemImageInfo>
{
/// <inheritdoc/>
public void Configure(EntityTypeBuilder<BaseItemImageInfo> builder)
{
builder.HasKey(e => e.Id);
builder.HasOne(e => e.Item).WithMany(e => e.Images).HasForeignKey(e => e.ItemId);
// Composite index for filtering by item and image type (also covers ItemId-only lookups)
builder.HasIndex(e => new { e.ItemId, e.ImageType });
}
}
|