轮播应用OK

This commit is contained in:
Zhanghu
2026-01-13 17:57:48 +08:00
parent f5d6db464e
commit 037a6b2079
24 changed files with 2148 additions and 40 deletions

View File

@@ -18,6 +18,7 @@ public class DashboardDbContext : DbContext
public DbSet<Playlist> Playlists { get; set; }
public DbSet<PlaylistItem> PlaylistItems { get; set; }
public DbSet<AppVersion> AppVersions { get; set; }
public DbSet<RotatorItem> RotatorItems { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
@@ -101,5 +102,17 @@ public class DashboardDbContext : DbContext
{
entity.HasIndex(e => new { e.Platform, e.Version });
});
// RotatorItem 配置
modelBuilder.Entity<RotatorItem>(entity =>
{
entity.HasKey(e => e.Id);
// 不配置关系,只配置索引,避免 EF Core 创建影子属性
// 外键约束在迁移中已定义,这里不再重复配置
// 同一应用中的轮播项按 Order 排序
entity.HasIndex(e => new { e.ApplicationId, e.Order });
});
}
}