轮播应用OK
This commit is contained in:
@@ -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 });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user