using Microsoft.EntityFrameworkCore; public sealed class LabDb : DbContext { public LabDb(DbContextOptions options) : base(options) { } public DbSet Items => Set(); protected override void OnModelCreating(ModelBuilder model) { model.Entity().HasIndex(x => new { x.SortKey, x.Id }); } } public sealed class Item { public int Id { get; set; } public int SortKey { get; set; } public string Name { get; set; } = ""; }